:root {
  color-scheme: light;
  --bg: #f8f2ea;
  --bg-2: #e8f0eb;
  --surface: #fffaf4;
  --surface-strong: #fffdf8;
  --surface-glass: rgba(255, 253, 248, 0.78);
  --surface-tint: rgba(232, 242, 236, 0.54);
  --text: #262220;
  --muted: #756d67;
  --line: rgba(91, 73, 61, 0.16);
  --line-strong: rgba(91, 73, 61, 0.26);
  --rose: #c75c6b;
  --rose-soft: #f4dce0;
  --coral: #df856b;
  --teal: #1f7169;
  --teal-soft: #dcefea;
  --gold: #af812e;
  --gold-soft: #f3e4bf;
  --plum: #6d6377;
  --charcoal: #292d2f;
  --shadow: 0 30px 84px rgba(53, 42, 35, 0.13), 0 9px 24px rgba(53, 42, 35, 0.08);
  --shadow-soft: 0 16px 42px rgba(53, 42, 35, 0.08);
  --shadow-card: 0 22px 58px rgba(53, 42, 35, 0.09), 0 1px 0 rgba(255, 255, 255, 0.7) inset;
  --radius: 8px;
  --tap: 44px;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(115deg, rgba(220, 239, 234, 0.58) 0%, transparent 34%),
    linear-gradient(245deg, rgba(244, 220, 224, 0.58) 0%, transparent 38%),
    linear-gradient(180deg, rgba(255, 251, 245, 0.98) 0%, rgba(248, 242, 234, 0.98) 48%, rgba(237, 242, 236, 0.98) 100%),
    repeating-linear-gradient(135deg, rgba(38, 34, 32, 0.026) 0 1px, transparent 1px 46px);
  background-attachment: fixed;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

::selection {
  background: rgba(199, 92, 107, 0.22);
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.62;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(36, 115, 107, 0.25);
  outline-offset: 3px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.75rem, 3vw, 2.65rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 1rem;
  line-height: 1.18;
  letter-spacing: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 300px;
  gap: 22px;
  width: 100%;
  max-width: 1840px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 22px;
}

body.is-locked .app-shell {
  pointer-events: none;
  user-select: none;
  visibility: hidden;
}

html:not(.app-ready).needs-auth .app-shell {
  visibility: hidden;
}

html:not(.app-ready).fast-session .lock-screen {
  display: none;
}

.sidebar,
.today-panel {
  align-self: start;
  position: sticky;
  top: 20px;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: calc(100vh - 40px);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 252, 248, 0.92), rgba(255, 247, 239, 0.82)),
    var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.workspace {
  min-width: 0;
  padding: 0 0 32px;
}

.brand-lockup,
.mini-profile,
.widget-heading,
.topbar,
.top-actions,
.activity-row,
.now-item,
.form-heading,
.memory-meta,
.plan-meta,
.message-meta,
.letter-header {
  display: flex;
  align-items: center;
}

.brand-lockup {
  gap: 10px;
  min-height: var(--tap);
}

.brand-mark {
  position: relative;
  overflow: hidden;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent),
    url("assets/ourworld-logo.png") center / cover no-repeat;
  box-shadow:
    0 12px 24px rgba(38, 18, 55, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.42);
}

.brand-mark::after {
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
  content: "";
  pointer-events: none;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0;
}

.person-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(223, 208, 195, 0.72);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.48);
}

.person-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-weight: 750;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.person-option.active {
  border-color: rgba(200, 90, 104, 0.36);
  background: linear-gradient(180deg, rgba(244, 216, 220, 0.92), rgba(255, 255, 255, 0.62));
  color: var(--text);
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  color: #fff;
  font-weight: 850;
  font-size: 0.83rem;
}

.avatar-me {
  background: var(--teal);
}

.avatar-partner {
  background: var(--rose);
}

.main-nav {
  display: grid;
  gap: 7px;
}

.nav-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 46px;
  padding: 0 12px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 760;
  transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.nav-item:hover,
.nav-item.active {
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.nav-item:hover {
  transform: translateY(-1px);
}

.nav-item.active .icon {
  color: var(--rose);
}

.nav-badge {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--rose);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
}

.nav-badge[hidden] {
  display: none;
}

.icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: currentColor;
}

.icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  min-height: 84px;
  margin-bottom: 16px;
  padding: 18px 20px;
  border: 1px solid rgba(223, 208, 195, 0.82);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(255, 252, 248, 0.96), rgba(255, 250, 245, 0.74)),
    var(--surface);
  box-shadow: var(--shadow-soft);
}

.topbar h1 {
  margin-top: 4px;
}

.top-actions {
  gap: 8px;
}

.top-logout {
  margin-top: 0;
  white-space: nowrap;
}

.notification-button {
  position: relative;
}

.action-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  padding: 0 6px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--rose);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
}

.action-badge[hidden] {
  display: none;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.icon-button,
.send-button {
  display: inline-grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  min-width: var(--tap);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--charcoal);
  box-shadow: 0 7px 16px rgba(58, 45, 38, 0.08);
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.icon-button:hover,
.send-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(58, 45, 38, 0.12);
}

.icon-button.ghost {
  background: transparent;
  box-shadow: none;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.widget,
.pulse-widget,
.tool-panel,
.timeline-item,
.letter-card,
.plan-card,
.message {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.widget,
.pulse-widget {
  min-height: 170px;
  padding: 20px;
}

.pulse-widget {
  position: relative;
  overflow: hidden;
  grid-column: span 7;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  align-items: center;
  gap: 22px;
  min-height: 260px;
  background:
    linear-gradient(135deg, rgba(244, 216, 220, 0.94), rgba(255, 250, 244, 0.96) 48%, rgba(217, 235, 231, 0.82)),
    linear-gradient(90deg, rgba(200, 90, 104, 0.08), transparent 42%, rgba(36, 115, 107, 0.1)),
    var(--surface);
}

.pulse-copy {
  display: grid;
  gap: 12px;
  max-width: 560px;
}

.pulse-copy h2 {
  font-size: clamp(1.8rem, 3.1vw, 3.05rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.pulse-copy > p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.45;
}

.pulse-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pulse-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(200, 90, 104, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.54);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.heart-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 142px;
  height: 142px;
  border-radius: 50%;
  color: #fff;
  background:
    linear-gradient(145deg, rgba(232, 137, 105, 0.62), transparent 46%),
    var(--rose);
  box-shadow:
    0 20px 44px rgba(200, 90, 104, 0.3),
    inset 0 -10px 24px rgba(90, 28, 35, 0.16);
}

.heart-button .icon {
  width: 52px;
  height: 52px;
}

.heart-button::after {
  position: absolute;
  inset: -10px;
  border: 1px solid rgba(200, 90, 104, 0.22);
  border-radius: 50%;
  content: "";
}

.heart-button.is-pulsing {
  animation: pulse-pop 620ms ease;
}

.heart-button:disabled,
.heart-button.is-busy {
  cursor: wait;
  opacity: 0.74;
}

@keyframes pulse-pop {
  0% {
    transform: scale(1);
  }
  38% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

.mood-widget {
  grid-column: span 5;
}

.safe-widget,
.countdown-widget,
.memory-widget,
.activity-widget {
  grid-column: span 4;
}

.question-widget {
  grid-column: span 8;
}

.widget-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.mini-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.mini-badge.complete {
  border-color: rgba(36, 115, 107, 0.24);
  background: var(--teal-soft);
  color: var(--teal);
}

.mood-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
}

.signal-detail {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.mood-chip {
  display: grid;
  place-items: center;
  min-height: 74px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--muted);
  font-weight: 800;
  text-align: center;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.mood-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(36, 115, 107, 0.26);
}

.mood-chip.active {
  border-color: rgba(36, 115, 107, 0.34);
  background: linear-gradient(180deg, rgba(217, 235, 231, 0.96), rgba(255, 255, 255, 0.78));
  color: var(--text);
}

.soft-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius);
  font-weight: 850;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.soft-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(58, 45, 38, 0.1);
}

.soft-button {
  margin-top: 18px;
  border: 1px solid rgba(36, 115, 107, 0.24);
  background: var(--teal-soft);
  color: var(--teal);
}

.tool-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.tool-actions .soft-button {
  margin-top: 0;
}

.compact-action {
  justify-self: start;
  min-height: 36px;
  margin-top: 6px;
  padding: 0 10px;
  font-size: 0.86rem;
}

.primary-button,
.send-button {
  background: var(--charcoal);
  color: #fff;
}

.safe-widget p,
.countdown-widget p,
.question-text {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.42;
}

.question-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--tap);
  gap: 8px;
  margin-top: 16px;
}

.question-form input {
  min-width: 0;
  min-height: var(--tap);
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--text);
}

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

.answer-card {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.64);
}

.answer-card.own {
  border-color: rgba(36, 115, 107, 0.22);
  background: rgba(213, 238, 236, 0.34);
}

.answer-card-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.answer-card strong {
  font-size: 0.82rem;
}

.answer-card-heading span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.answer-card span,
.answer-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.countdown-number {
  margin: 18px 0 2px;
  color: var(--rose);
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: 0;
}

.memory-preview {
  display: grid;
  grid-template-columns: 82px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 96px;
}

.memory-thumb,
.letter-seal,
.plan-dot {
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: #fff;
  font-weight: 900;
}

.memory-thumb {
  width: 82px;
  aspect-ratio: 1;
  background:
    linear-gradient(135deg, rgba(46, 50, 53, 0.2), transparent 46%),
    var(--accent, var(--teal));
}

.memory-thumb-button {
  padding: 0;
  overflow: hidden;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.memory-thumb-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(58, 45, 38, 0.12);
}

.memory-thumb.image-thumb {
  background: var(--surface-strong);
}

.memory-thumb.image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.memory-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.memory-copy strong {
  overflow-wrap: anywhere;
}

.memory-copy span,
.memory-copy p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.activity-widget {
  display: grid;
  gap: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(244, 229, 198, 0.34)),
    var(--surface);
}

.rhythm-line {
  color: var(--text);
  font-size: 0.94rem;
  line-height: 1.42;
}

.rhythm-nudge {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(36, 115, 107, 0.18);
  border-radius: var(--radius);
  background: rgba(217, 235, 231, 0.58);
  color: var(--teal);
}

.rhythm-nudge .icon {
  width: 22px;
  height: 22px;
}

.rhythm-nudge strong {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.3;
}

.reminder-strip {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(200, 90, 104, 0.2);
  border-radius: var(--radius);
  background: rgba(244, 216, 220, 0.52);
  color: var(--rose);
}

.reminder-strip[hidden] {
  display: none;
}

.reminder-strip[data-kind="plan"] {
  border-color: rgba(184, 133, 47, 0.24);
  background: rgba(244, 229, 198, 0.56);
  color: var(--gold);
}

.reminder-strip[data-kind="question"] {
  border-color: rgba(36, 115, 107, 0.2);
  background: rgba(217, 235, 231, 0.52);
  color: var(--teal);
}

.reminder-strip[data-kind="letter"],
.reminder-strip[data-kind="memory"] {
  border-color: rgba(184, 133, 47, 0.24);
  background: rgba(244, 229, 198, 0.56);
  color: var(--gold);
}

.reminder-strip[data-kind="signal"] {
  border-color: rgba(36, 115, 107, 0.22);
  background: rgba(217, 235, 231, 0.56);
  color: var(--teal);
}

.reminder-strip .icon {
  width: 22px;
  height: 22px;
}

.reminder-strip div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.reminder-strip strong {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.3;
}

.reminder-strip span:not(.icon) {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.mini-activity-list {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid rgba(223, 208, 195, 0.72);
  border-radius: var(--radius);
  background: rgba(255, 250, 245, 0.58);
}

.mini-activity-empty {
  display: grid;
  gap: 3px;
  padding: 10px;
}

.mini-activity-empty strong,
.mini-activity-item strong {
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.25;
}

.mini-activity-empty span,
.mini-activity-item p,
.mini-activity-item .activity-feed-title span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

.mini-activity-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 10px;
  border-top: 1px solid rgba(223, 208, 195, 0.62);
}

.mini-activity-item:first-child {
  border-top: 0;
}

.activity-row {
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  color: var(--muted);
}

.activity-row strong {
  max-width: 62%;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.25;
  text-align: right;
  overflow-wrap: anywhere;
}

.chat-layout {
  display: grid;
  grid-template-rows: auto minmax(420px, calc(100vh - 250px)) auto;
  gap: 12px;
  min-height: calc(100vh - 132px);
  padding: 12px;
  border: 1px solid rgba(223, 208, 195, 0.82);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 252, 248, 0.82), rgba(255, 247, 239, 0.64)),
    var(--surface);
  box-shadow: var(--shadow-soft);
}

.chat-status-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.64);
  box-shadow: none;
}

.chat-status-main {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.chat-status-main h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

#chat-presence-detail {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  text-align: right;
}

.presence-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #c8b9ad;
  box-shadow: 0 0 0 4px rgba(200, 185, 173, 0.16);
}

.presence-dot.online {
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(36, 115, 107, 0.16);
}

.presence-dot.typing {
  background: var(--rose);
  box-shadow: 0 0 0 4px rgba(200, 90, 104, 0.18);
  animation: presence-pulse 980ms ease-in-out infinite;
}

@keyframes presence-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  min-height: 420px;
  padding: 12px 6px 6px;
  border: 1px solid rgba(223, 208, 195, 0.62);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 250, 244, 0.38)),
    repeating-linear-gradient(0deg, rgba(46, 50, 53, 0.018) 0 1px, transparent 1px 34px);
}

.empty-chat,
.empty-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin: auto;
  max-width: 390px;
  padding: 24px;
  border: 1px dashed rgba(117, 107, 99, 0.32);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(255, 250, 245, 0.7)),
    var(--surface);
  text-align: center;
}

.empty-state {
  grid-column: 1 / -1;
  min-height: 220px;
  width: 100%;
  align-content: center;
}

.empty-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(36, 115, 107, 0.18);
  border-radius: var(--radius);
  background: rgba(217, 235, 231, 0.72);
  color: var(--teal);
}

.empty-icon .icon {
  width: 24px;
  height: 24px;
}

.empty-chat span:last-child,
.empty-state span:last-child {
  color: var(--muted);
  line-height: 1.42;
}

.message {
  display: grid;
  gap: 8px;
  max-width: min(620px, 82%);
  padding: 12px 14px;
  box-shadow: 0 8px 18px rgba(58, 45, 38, 0.07);
  overflow-wrap: anywhere;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.message:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(58, 45, 38, 0.1);
}

.message-day-separator {
  display: grid;
  place-items: center;
  margin: 2px 0;
}

.message-day-separator span {
  padding: 6px 10px;
  border: 1px solid rgba(223, 208, 195, 0.82);
  border-radius: 999px;
  background: rgba(255, 250, 245, 0.82);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 860;
}

.message.mine {
  align-self: flex-end;
  background:
    linear-gradient(145deg, rgba(36, 115, 107, 0.18), transparent 42%),
    var(--charcoal);
  color: #fff;
  border-color: transparent;
}

.message.theirs {
  align-self: flex-start;
  background: var(--surface-strong);
}

.message-meta {
  justify-content: space-between;
  gap: 12px;
  color: inherit;
  opacity: 0.74;
  font-size: 0.76rem;
  font-weight: 800;
}

.message-body {
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.message-reply-preview {
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  border-left: 3px solid currentColor;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.14);
}

.message.theirs .message-reply-preview {
  background: rgba(217, 235, 231, 0.48);
  color: var(--teal);
}

.message-reply-preview span {
  font-size: 0.72rem;
  font-weight: 900;
  opacity: 0.76;
}

.message-reply-preview strong {
  color: inherit;
  font-size: 0.86rem;
  line-height: 1.32;
  overflow-wrap: anywhere;
}

.message-image {
  display: block;
  width: min(340px, 100%);
  max-height: 320px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.message-image-button {
  display: block;
  width: fit-content;
  max-width: 100%;
  padding: 0;
  border-radius: var(--radius);
  background: transparent;
  text-align: left;
}

.message-image-button:hover .message-image {
  filter: saturate(1.04) contrast(1.02);
}

.message.theirs .message-image {
  border-color: var(--line);
}

.message-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.reaction-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.message-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.message-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(223, 208, 195, 0.78);
  background: rgba(255, 250, 245, 0.72);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.message-action .icon {
  width: 14px;
  height: 14px;
}

.message.mine .message-action {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.82);
}

.message-action.danger {
  color: var(--rose);
}

.message.mine .message-action.danger {
  color: #fff;
}

.reaction-button {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 30px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.reaction-button.active {
  border-color: rgba(200, 90, 104, 0.28);
  background: rgba(244, 216, 220, 0.96);
  color: var(--rose);
}

.message.theirs .reaction-button,
.message.theirs .reaction-button.active {
  border: 1px solid var(--line);
}

.message-seen {
  color: inherit;
  opacity: 0.66;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.composer-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: right;
}

.composer-status:empty,
.composer-status[hidden] {
  display: none;
}

.composer.is-busy {
  opacity: 0.78;
}

.chat-draft-context {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 36px;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(36, 115, 107, 0.2);
  border-radius: var(--radius);
  background: rgba(217, 235, 231, 0.68);
  color: var(--teal);
}

.chat-draft-context[hidden] {
  display: none;
}

.chat-draft-context > .icon {
  width: 20px;
  height: 20px;
}

.chat-draft-context div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.chat-draft-context strong {
  color: var(--text);
  font-size: 0.86rem;
}

.chat-draft-context span:not(.icon) {
  color: var(--muted);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-draft-context .icon-button .icon {
  rotate: 45deg;
}

.chat-image-preview {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 36px;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(200, 90, 104, 0.22);
  border-radius: var(--radius);
  background: rgba(244, 216, 220, 0.48);
}

.chat-image-preview[hidden] {
  display: none;
}

.chat-image-preview img {
  width: 72px;
  height: 54px;
  object-fit: cover;
  border: 1px solid rgba(223, 208, 195, 0.72);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.chat-image-preview div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.chat-image-preview strong {
  color: var(--text);
  font-size: 0.88rem;
}

.chat-image-preview span {
  color: var(--muted);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-image-preview .icon-button .icon {
  rotate: 45deg;
}

.composer {
  display: grid;
  grid-template-columns: 44px 0 minmax(0, 1fr) 44px;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
  backdrop-filter: blur(14px);
}

.composer input,
.tool-panel input,
.tool-panel textarea,
.tool-panel select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--text);
}

.composer input {
  min-height: 44px;
  padding: 0 14px;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  min-height: calc(100vh - 132px);
}

.tool-panel {
  position: sticky;
  top: 128px;
  display: grid;
  gap: 14px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.64), rgba(255, 250, 245, 0.86)),
    var(--surface);
}

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

.form-heading {
  align-items: flex-start;
  flex-direction: column;
  gap: 4px;
}

.tool-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.settings-form label,
.lock-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.tool-panel input,
.tool-panel textarea,
.tool-panel select,
.settings-form input,
.lock-form input,
.lock-form select {
  min-height: 42px;
  padding: 10px 12px;
  color: var(--text);
  font-weight: 650;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.tool-panel input:hover,
.tool-panel textarea:hover,
.tool-panel select:hover,
.settings-form input:hover,
.lock-form input:hover,
.lock-form select:hover {
  border-color: rgba(36, 115, 107, 0.26);
}

.settings-form input,
.lock-form input,
.lock-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.tool-panel textarea {
  resize: vertical;
  min-height: 104px;
  line-height: 1.42;
}

.tool-panel textarea[name="note"],
.tool-panel textarea[name="checklist"] {
  min-height: 82px;
}

.memory-image-hint {
  margin-top: -6px;
}

.timeline {
  display: grid;
  gap: 12px;
  min-height: 420px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.7), rgba(255, 250, 245, 0.92)),
    var(--surface);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.timeline-item.editing {
  border-color: rgba(36, 115, 107, 0.32);
  box-shadow: 0 20px 38px rgba(36, 115, 107, 0.12);
}

.timeline-item:hover,
.letter-card:hover,
.plan-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(58, 45, 38, 0.1);
}

.timeline-item .memory-thumb {
  width: 108px;
}

.memory-meta {
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-bottom: 8px;
}

.memory-meta span,
.plan-meta span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 820;
}

.letter-grid,
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 12px;
  min-height: 420px;
}

.letter-card,
.plan-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 206px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 250, 245, 0.92)),
    var(--surface);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.letter-card::before,
.plan-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--teal), var(--gold), var(--rose));
  content: "";
}

.letter-card.editing {
  border-color: rgba(36, 115, 107, 0.32);
  box-shadow: 0 20px 38px rgba(36, 115, 107, 0.12);
}

.letter-header {
  justify-content: space-between;
  gap: 12px;
}

.letter-seal {
  width: 42px;
  height: 42px;
  background:
    linear-gradient(145deg, rgba(232, 137, 105, 0.5), transparent 48%),
    var(--rose);
  box-shadow: 0 10px 18px rgba(200, 90, 104, 0.18);
}

.letter-card p {
  color: var(--muted);
  line-height: 1.45;
}

.letter-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px 38px;
  gap: 8px;
  align-items: center;
}

.letter-actions .soft-button {
  min-width: 0;
  margin-top: 0;
}

.letter-body {
  display: none;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
  color: var(--text);
  line-height: 1.55;
  white-space: pre-wrap;
}

.letter-card.open .letter-body {
  display: block;
}

.plan-card {
  min-height: 210px;
}

.plan-card.editing {
  border-color: rgba(36, 115, 107, 0.32);
  box-shadow: 0 20px 38px rgba(36, 115, 107, 0.12);
}

.plan-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-dot {
  width: 32px;
  height: 32px;
  background:
    linear-gradient(145deg, rgba(244, 229, 198, 0.42), transparent 48%),
    var(--teal);
}

.plan-days {
  margin-top: 4px;
  font-size: 3.2rem;
  line-height: 0.9;
  color: var(--rose);
  font-weight: 920;
  letter-spacing: 0;
}

.plan-actions {
  display: flex;
  gap: 8px;
  justify-self: end;
  align-self: end;
}

.plan-detail-list {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.plan-detail-list span {
  padding: 7px 9px;
  border: 1px solid rgba(223, 208, 195, 0.72);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.52);
  overflow-wrap: anywhere;
}

.plan-checklist {
  display: grid;
  gap: 7px;
  padding-top: 4px;
}

.plan-checklist > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.plan-check {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--text);
  text-align: left;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.plan-check:hover {
  transform: translateY(-1px);
  border-color: rgba(36, 115, 107, 0.28);
  background: rgba(255, 255, 255, 0.78);
}

.plan-check span {
  display: grid;
  place-items: center;
  width: 22px;
  aspect-ratio: 1;
  border: 1px solid rgba(36, 115, 107, 0.28);
  border-radius: 6px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 900;
}

.plan-check strong {
  overflow-wrap: anywhere;
}

.plan-check.done {
  border-color: rgba(36, 115, 107, 0.24);
  background: rgba(213, 238, 236, 0.64);
}

.plan-check.done strong {
  color: var(--muted);
  text-decoration: line-through;
}

.timeline-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.letter-action-button,
.plan-action-button,
.memory-action-button,
.delete-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  transition: transform 150ms ease, background 150ms ease;
}

.letter-action-button,
.plan-action-button,
.memory-action-button {
  border: 1px solid rgba(36, 115, 107, 0.18);
  background: var(--teal-soft);
  color: var(--teal);
}

.letter-action-button:hover,
.plan-action-button:hover,
.memory-action-button:hover {
  transform: translateY(-1px);
  background: rgba(213, 238, 236, 0.9);
}

.delete-button {
  background: #f7ece5;
  color: #9b3f38;
}

.delete-button:hover {
  transform: translateY(-1px);
  background: #f2ded7;
}

.today-panel {
  gap: 18px;
}

.mini-profile {
  gap: 12px;
  padding-bottom: 2px;
}

.mini-profile h2 {
  margin-top: 3px;
}

.avatar-stack {
  display: flex;
}

.avatar-stack .avatar + .avatar {
  margin-left: -8px;
  box-shadow: 0 0 0 3px var(--surface);
}

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

.now-item {
  align-items: flex-start;
  gap: 12px;
  min-height: 74px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.now-button {
  width: 100%;
  background: transparent;
  color: inherit;
  text-align: left;
}

.now-button:hover {
  color: var(--teal);
}

.now-item .icon {
  width: 24px;
  height: 24px;
  color: var(--teal);
}

.now-item div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.now-item strong {
  overflow-wrap: anywhere;
}

.now-item span:last-child {
  color: var(--muted);
  font-size: 0.88rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 80;
  transform: translate(-50%, 20px);
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--charcoal);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  font-weight: 780;
}

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

.lock-screen,
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background:
    linear-gradient(180deg, rgba(255, 250, 244, 0.8), rgba(247, 239, 231, 0.84)),
    rgba(248, 241, 234, 0.78);
  backdrop-filter: blur(20px);
}

.lock-screen.hidden,
.modal-backdrop[aria-hidden="true"] {
  display: none;
}

.lock-card,
.modal-card {
  width: min(430px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 250, 245, 0.92)),
    var(--surface);
  box-shadow: var(--shadow);
}

.lock-card {
  display: grid;
  gap: 22px;
  padding: 22px;
}

.lock-form,
.settings-form {
  display: none;
  gap: 14px;
}

.lock-form.active,
.settings-form {
  display: grid;
}

.modal-card {
  display: grid;
  gap: 16px;
  max-height: min(86vh, 760px);
  max-height: min(86dvh, 760px);
  overflow: auto;
  padding: 18px;
}

.recap-modal-card {
  width: min(680px, 100%);
}

.activity-modal-card {
  width: min(760px, 100%);
}

.media-modal-card {
  width: min(900px, 100%);
}

.settings-modal-card {
  width: min(760px, 100%);
}

.modal-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.modal-subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.modal-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 8px;
}

.modal-heading .icon-button .icon {
  rotate: 45deg;
}

.activity-feed {
  display: grid;
  gap: 8px;
  max-height: min(62vh, 560px);
  overflow: auto;
  padding-right: 4px;
}

.activity-feed-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 74px;
  padding: 12px;
  border: 1px solid rgba(223, 208, 195, 0.78);
  border-radius: var(--radius);
  background: rgba(255, 250, 245, 0.68);
}

.activity-feed-item.unread {
  border-color: rgba(200, 90, 104, 0.34);
  background: rgba(244, 216, 220, 0.32);
}

.activity-feed-item[data-kind="message"] .activity-feed-icon,
.reminder-strip[data-kind="message"] {
  background: rgba(244, 216, 220, 0.42);
  color: var(--rose);
}

.activity-feed-item[data-kind="letter"] .activity-feed-icon,
.activity-feed-item[data-kind="memory"] .activity-feed-icon {
  background: rgba(244, 229, 198, 0.58);
  color: var(--gold);
}

.activity-feed-item[data-kind="signal"] .activity-feed-icon {
  background: rgba(217, 235, 231, 0.78);
  color: var(--teal);
}

.activity-feed-icon {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: var(--radius);
  background: rgba(217, 235, 231, 0.72);
  color: var(--teal);
}

.activity-feed-icon .icon {
  width: 18px;
  height: 18px;
}

.activity-feed-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.activity-feed-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.activity-feed-title strong {
  color: var(--text);
  font-size: 0.96rem;
  line-height: 1.25;
}

.activity-feed-title span {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.activity-new-pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(200, 90, 104, 0.14);
  color: var(--rose);
  font-size: 0.7rem;
  font-weight: 900;
}

.activity-feed-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.media-viewer {
  display: grid;
  place-items: center;
  min-height: 180px;
  overflow: hidden;
  border: 1px solid rgba(223, 208, 195, 0.78);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(36, 115, 107, 0.08), rgba(200, 90, 104, 0.08)),
    var(--surface-strong);
}

.media-viewer img {
  display: block;
  width: 100%;
  max-height: min(66vh, 640px);
  object-fit: contain;
}

.media-viewer img[hidden] {
  display: none;
}

.media-copy {
  display: grid;
  gap: 6px;
}

.media-copy strong {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.media-copy p {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.media-copy p[hidden] {
  display: none;
}

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

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

.settings-account-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 98px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(255, 250, 245, 0.92)),
    var(--surface);
}

.settings-account-card[data-status="ok"] {
  border-color: rgba(36, 115, 107, 0.24);
  background:
    linear-gradient(180deg, rgba(217, 235, 231, 0.5), rgba(255, 250, 245, 0.92)),
    var(--surface);
}

.settings-account-card[data-status="warning"] {
  border-color: rgba(184, 133, 47, 0.34);
  background:
    linear-gradient(180deg, rgba(244, 229, 198, 0.58), rgba(255, 250, 245, 0.92)),
    var(--surface);
}

.settings-account-card h3 {
  margin: 3px 0 2px;
  font-size: 1rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.settings-account-card span:not(.avatar):not(.icon) {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.status-pill {
  align-self: start;
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 5px 9px;
  border: 1px solid rgba(117, 107, 99, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  white-space: nowrap;
}

.status-pill[data-status="ok"] {
  border-color: rgba(36, 115, 107, 0.24);
  background: rgba(217, 235, 231, 0.78);
  color: var(--teal);
}

.status-pill[data-status="warning"] {
  border-color: rgba(184, 133, 47, 0.28);
  background: rgba(244, 229, 198, 0.82);
  color: #8a621f;
}

.settings-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.settings-section-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.settings-section h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 94px;
  gap: 12px;
}

.settings-badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border: 1px solid rgba(36, 115, 107, 0.22);
  border-radius: 999px;
  background: rgba(213, 238, 236, 0.7);
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.settings-status-list {
  display: grid;
  gap: 8px;
}

.settings-status-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
}

.settings-status-row:last-child {
  border-bottom: 0;
}

.settings-status-row strong {
  max-width: 62%;
  color: var(--text);
  text-align: right;
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.pin-setting {
  margin-top: 2px;
}

.settings-form label.is-disabled {
  opacity: 0.58;
}

.settings-form input:disabled {
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.helper-text {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.42;
}

.recap-content {
  display: grid;
  gap: 14px;
}

.recap-hero {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(36, 115, 107, 0.22);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(213, 238, 236, 0.7), rgba(255, 250, 244, 0.8)),
    var(--surface-strong);
}

.recap-hero h3 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.2;
}

.recap-hero p:last-child {
  color: var(--muted);
  line-height: 1.42;
}

.recap-hero-actions {
  display: grid;
  gap: 8px;
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid rgba(36, 115, 107, 0.16);
}

.recap-hero-actions span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.recap-hero-actions strong {
  font-size: 0.98rem;
  line-height: 1.35;
}

.recap-grid,
.recap-note-grid {
  display: grid;
  gap: 10px;
}

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

.recap-note-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.recap-stat,
.recap-note {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
}

.recap-stat {
  display: grid;
  gap: 6px;
  padding: 12px;
}

.recap-stat strong {
  font-size: 1.55rem;
  line-height: 1;
}

.recap-stat span,
.recap-note p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.recap-note {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.recap-note strong {
  overflow-wrap: anywhere;
}

.recap-list {
  display: grid;
  gap: 7px;
}

.recap-list span {
  padding: 8px 10px;
  border: 1px solid rgba(223, 208, 195, 0.78);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

/* Visual polish pass */
.app-shell {
  grid-template-columns: 246px minmax(0, 1fr) 284px;
  gap: 24px;
  max-width: 1540px;
  padding: 26px;
}

.sidebar,
.today-panel {
  border-color: var(--line);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.92), rgba(255, 249, 241, 0.72)),
    linear-gradient(115deg, rgba(220, 239, 234, 0.38), transparent 52%),
    var(--surface-glass);
  box-shadow: var(--shadow);
}

.sidebar::before,
.today-panel::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--gold), var(--rose));
  opacity: 0.72;
  content: "";
}

.brand-mark {
  width: 38px;
  height: 38px;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.82),
    0 12px 24px rgba(200, 92, 107, 0.18);
}

.brand-name {
  font-weight: 900;
}

.person-switch {
  border-color: var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 250, 245, 0.42));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.person-option {
  border-color: transparent;
}

.person-option.active {
  border-color: rgba(199, 92, 107, 0.26);
  background:
    linear-gradient(180deg, rgba(244, 220, 224, 0.94), rgba(255, 253, 248, 0.62));
  box-shadow: 0 10px 22px rgba(199, 92, 107, 0.12);
}

.nav-item {
  position: relative;
  border: 1px solid transparent;
}

.nav-item::before {
  position: absolute;
  inset: 10px auto 10px 0;
  width: 3px;
  border-radius: 999px;
  background: transparent;
  content: "";
}

.nav-item:hover,
.nav-item.active {
  border-color: rgba(91, 73, 61, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 250, 245, 0.7));
  box-shadow: 0 14px 30px rgba(53, 42, 35, 0.08);
}

.nav-item.active::before {
  background: linear-gradient(180deg, var(--rose), var(--teal));
}

.topbar {
  min-height: 76px;
  margin-bottom: 20px;
  padding: 4px 2px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.topbar h1 {
  font-size: clamp(2rem, 3.2vw, 3rem);
}

.icon-button,
.send-button,
.soft-button,
.primary-button,
.mood-chip,
.question-form input,
.composer,
.composer input,
.tool-panel input,
.tool-panel textarea,
.tool-panel select,
.settings-form input,
.lock-form input,
.lock-form select {
  border-color: var(--line);
}

.icon-button,
.send-button {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 249, 241, 0.88));
  box-shadow:
    0 12px 24px rgba(53, 42, 35, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.primary-button,
.send-button {
  background:
    linear-gradient(135deg, rgba(42, 45, 47, 0.98), rgba(31, 48, 49, 0.98));
  color: #fff;
  box-shadow: 0 14px 28px rgba(42, 45, 47, 0.2);
}

.soft-button {
  background:
    linear-gradient(180deg, rgba(220, 239, 234, 0.96), rgba(255, 253, 248, 0.72));
  color: var(--teal);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.widget,
.pulse-widget,
.tool-panel,
.timeline-item,
.letter-card,
.plan-card,
.chat-layout,
.settings-account-card,
.settings-section {
  border-color: var(--line);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.86), rgba(255, 248, 240, 0.72)),
    var(--surface-glass);
  box-shadow: var(--shadow-card);
}

.widget,
.pulse-widget,
.tool-panel,
.timeline-item,
.letter-card,
.plan-card,
.chat-layout {
  position: relative;
  overflow: hidden;
}

.widget::before,
.tool-panel::before,
.chat-layout::before {
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.92), transparent);
  content: "";
}

.pulse-widget {
  grid-template-columns: minmax(0, 1fr) 172px;
  min-height: 284px;
  background:
    linear-gradient(135deg, rgba(244, 220, 224, 0.88), rgba(255, 251, 245, 0.96) 46%, rgba(220, 239, 234, 0.88)),
    linear-gradient(90deg, rgba(199, 92, 107, 0.08), transparent 44%, rgba(31, 113, 105, 0.1)),
    var(--surface);
}

.pulse-widget::after {
  position: absolute;
  inset: 13px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: var(--radius);
  pointer-events: none;
  content: "";
}

.pulse-copy {
  position: relative;
  z-index: 1;
}

.pulse-copy h2 {
  max-width: 8.5em;
}

.pulse-meta span,
.mini-badge,
.message-day-separator span,
.status-pill,
.settings-badge {
  border-color: rgba(91, 73, 61, 0.12);
  background: rgba(255, 253, 248, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.heart-button {
  z-index: 1;
  width: 156px;
  height: 156px;
  background:
    radial-gradient(circle at 38% 30%, rgba(255, 255, 255, 0.22), transparent 26%),
    linear-gradient(145deg, rgba(223, 133, 107, 0.72), transparent 46%),
    linear-gradient(135deg, #d06172, var(--rose));
  box-shadow:
    0 26px 54px rgba(199, 92, 107, 0.3),
    0 0 0 12px rgba(255, 255, 255, 0.5),
    0 0 0 13px rgba(199, 92, 107, 0.12),
    inset 0 -12px 28px rgba(90, 28, 35, 0.16);
}

.heart-button::after {
  inset: -18px;
  border-color: rgba(199, 92, 107, 0.16);
}

.mood-chip {
  min-height: 70px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 250, 245, 0.7));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.mood-chip.active {
  border-color: rgba(31, 113, 105, 0.32);
  background:
    linear-gradient(180deg, rgba(220, 239, 234, 0.98), rgba(255, 253, 248, 0.72));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.76),
    0 12px 24px rgba(31, 113, 105, 0.12);
}

.activity-widget {
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.82), rgba(243, 228, 191, 0.26)),
    var(--surface-glass);
}

.mini-activity-list,
.message-list,
.letter-body,
.plan-detail-list span,
.plan-check,
.answer-card,
.activity-feed-item,
.media-viewer {
  border-color: rgba(91, 73, 61, 0.13);
  background-color: rgba(255, 253, 248, 0.62);
}

.chat-layout {
  grid-template-rows: auto minmax(430px, calc(100vh - 260px)) auto;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.82), rgba(248, 242, 234, 0.58)),
    var(--surface-glass);
}

.chat-status-bar,
.composer {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 250, 245, 0.68));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.message-list {
  padding: 14px 8px 8px;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.42), rgba(220, 239, 234, 0.22)),
    repeating-linear-gradient(0deg, rgba(38, 34, 32, 0.018) 0 1px, transparent 1px 36px);
}

.message {
  box-shadow: 0 12px 28px rgba(53, 42, 35, 0.08);
}

.message.mine {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent 44%),
    linear-gradient(135deg, #234b49, var(--teal));
}

.message.theirs {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 250, 245, 0.86));
}

.split-layout {
  gap: 18px;
}

.tool-panel {
  top: 116px;
}

.tool-panel input,
.tool-panel textarea,
.tool-panel select,
.settings-form input,
.lock-form input,
.lock-form select,
.question-form input,
.composer input {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 252, 248, 0.88));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.tool-panel input:focus,
.tool-panel textarea:focus,
.tool-panel select:focus,
.settings-form input:focus,
.lock-form input:focus,
.lock-form select:focus,
.question-form input:focus,
.composer input:focus {
  border-color: rgba(31, 113, 105, 0.34);
  box-shadow:
    0 0 0 4px rgba(31, 113, 105, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.timeline-item,
.letter-card,
.plan-card {
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.82), rgba(255, 248, 240, 0.72)),
    var(--surface-glass);
}

.timeline-item:hover,
.letter-card:hover,
.plan-card:hover {
  box-shadow: 0 24px 50px rgba(53, 42, 35, 0.12);
}

.today-panel {
  gap: 20px;
}

.now-item {
  border-top-color: rgba(91, 73, 61, 0.13);
}

.lock-screen,
.modal-backdrop {
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.82), rgba(248, 242, 234, 0.86)),
    repeating-linear-gradient(135deg, rgba(38, 34, 32, 0.02) 0 1px, transparent 1px 42px);
  backdrop-filter: blur(24px) saturate(1.04);
}

.lock-card,
.modal-card {
  position: relative;
  overflow: hidden;
  border-color: var(--line);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.88), rgba(255, 249, 241, 0.76)),
    var(--surface-glass);
  box-shadow:
    0 34px 90px rgba(53, 42, 35, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
}

.lock-card::before,
.modal-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--gold), var(--rose));
  opacity: 0.74;
  content: "";
}

.lock-card {
  padding: 24px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 218px minmax(0, 1fr);
  }

  .today-panel {
    display: none;
  }

  .safe-widget,
  .question-widget,
  .countdown-widget,
  .memory-widget,
  .activity-widget {
    grid-column: span 6;
  }
}

@media (max-width: 840px) {
  body {
    padding-bottom: calc(84px + env(safe-area-inset-bottom));
  }

  .app-shell {
    display: block;
    padding: 14px;
  }

  .sidebar {
    position: fixed;
    inset: auto max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 8px;
  }

  .brand-lockup,
  .person-switch {
    display: none;
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
  }

  .nav-item {
    position: relative;
    grid-template-columns: 1fr;
    justify-items: center;
    min-height: 58px;
    padding: 6px 4px;
    font-size: 0.72rem;
  }

  .nav-item .icon {
    width: 21px;
    height: 21px;
  }

  .nav-badge {
    position: absolute;
    top: 5px;
    right: 8px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.66rem;
  }

  .workspace {
    padding: 0;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 8;
    min-height: 64px;
    padding-top: 4px;
    background:
      linear-gradient(180deg, rgba(247, 239, 231, 0.96), rgba(247, 239, 231, 0.76) 72%, transparent);
    backdrop-filter: blur(10px);
  }

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

  .pulse-widget,
  .mood-widget,
  .safe-widget,
  .question-widget,
  .countdown-widget,
  .memory-widget,
  .activity-widget {
    grid-column: auto;
  }

  .pulse-widget {
    grid-template-columns: minmax(0, 1fr) 112px;
    min-height: 198px;
  }

  .heart-button {
    width: 104px;
    height: 104px;
  }

  .heart-button .icon {
    width: 42px;
    height: 42px;
  }

  .mood-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .tool-panel {
    position: static;
  }

  .timeline,
  .letter-grid,
  .plan-grid {
    min-height: 260px;
  }

  .timeline-item {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .timeline-item .memory-thumb {
    width: 82px;
  }

  .timeline-item .timeline-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .timeline-item .memory-action-button,
  .timeline-item .delete-button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding: 10px;
  }

  .top-actions {
    display: flex;
  }

  #install-button {
    display: none;
  }

  .top-logout {
    width: var(--tap);
    min-width: var(--tap);
    padding: 0;
  }

  .logout-label {
    display: none;
  }

  h1 {
    font-size: 1.62rem;
  }

  .widget,
  .pulse-widget {
    padding: 14px;
  }

  .pulse-widget {
    grid-template-columns: 1fr;
  }

  .heart-button {
    width: 112px;
    height: 112px;
    justify-self: center;
  }

  .memory-preview {
    grid-template-columns: 70px 1fr;
  }

  .memory-thumb {
    width: 70px;
  }

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

  .timeline-item .memory-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
  }

  .chat-layout {
    grid-template-rows: auto minmax(360px, calc(100vh - 244px)) auto;
    min-height: calc(100vh - 118px);
    padding: 8px;
  }

  .chat-status-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  #chat-presence-detail {
    text-align: left;
  }

  .message {
    max-width: 94%;
  }

  .empty-chat,
  .empty-state {
    padding: 18px;
  }

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

  .settings-overview {
    grid-template-columns: 1fr;
  }

  .settings-account-card {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .settings-account-card .status-pill {
    grid-column: 1 / -1;
    justify-self: start;
  }

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

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

  .settings-section-heading,
  .settings-status-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .settings-status-row strong {
    max-width: 100%;
    text-align: left;
  }

  .recap-grid,
  .recap-note-grid {
    grid-template-columns: 1fr;
  }

  .modal-heading,
  .modal-tools,
  .activity-feed-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .activity-feed-item {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .activity-feed-item .compact-action {
    grid-column: 1 / -1;
    width: 100%;
  }

  .activity-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .activity-row strong {
    max-width: 100%;
    text-align: left;
  }

  .modal-actions {
    grid-column: auto;
  }

  .modal-actions .soft-button,
  .modal-actions .primary-button,
  .auth-actions .soft-button,
  .auth-actions .primary-button {
    width: 100%;
  }

  .auth-actions {
    grid-template-columns: 1fr;
  }
}

/* Art direction pass */
:root {
  --paper: rgba(255, 253, 248, 0.92);
  --paper-soft: rgba(255, 250, 244, 0.7);
  --ink-soft: rgba(38, 34, 32, 0.72);
  --hairline: rgba(38, 34, 32, 0.08);
  --glow-rose: 0 34px 72px rgba(199, 92, 107, 0.2);
  --glow-teal: 0 30px 68px rgba(31, 113, 105, 0.16);
}

body {
  color: #241f1d;
}

.app-shell {
  grid-template-columns: 238px minmax(0, 1fr) 276px;
  gap: 28px;
  max-width: 1480px;
  padding: clamp(18px, 2.4vw, 34px);
}

.workspace {
  padding-bottom: 56px;
}

.sidebar,
.today-panel {
  top: clamp(16px, 2vw, 28px);
  min-height: calc(100vh - clamp(32px, 4vw, 56px));
  padding: 20px;
  border-color: rgba(38, 34, 32, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.88), rgba(255, 248, 240, 0.68)),
    linear-gradient(135deg, rgba(220, 239, 234, 0.48), transparent 54%),
    rgba(255, 250, 244, 0.72);
  box-shadow:
    0 26px 78px rgba(53, 42, 35, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.brand-lockup {
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 11px;
}

.brand-name {
  font-size: 1.2rem;
  letter-spacing: 0;
}

.person-switch {
  gap: 7px;
  padding: 5px;
}

.person-option {
  min-height: 48px;
  font-size: 0.93rem;
}

.avatar {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
}

.nav-item {
  min-height: 50px;
  padding-inline: 13px;
  color: rgba(38, 34, 32, 0.64);
}

.nav-item.active {
  color: var(--text);
}

.topbar {
  min-height: 72px;
  margin: 0 0 22px;
  padding: 2px 0 18px;
}

.topbar .eyebrow {
  color: rgba(38, 34, 32, 0.5);
}

.topbar h1 {
  margin-top: 3px;
  font-size: clamp(2.1rem, 4.2vw, 3.45rem);
  font-weight: 920;
  line-height: 0.96;
}

.top-actions {
  align-self: flex-start;
  padding-top: 4px;
}

.home-grid {
  gap: 18px;
}

.widget,
.pulse-widget {
  min-height: 178px;
  padding: 22px;
}

.pulse-widget {
  grid-column: span 8;
  grid-template-columns: minmax(0, 1fr) 190px;
  min-height: 328px;
  padding: clamp(24px, 3vw, 34px);
  box-shadow:
    var(--glow-rose),
    var(--shadow-card);
}

.pulse-copy {
  gap: 14px;
}

.pulse-copy h2 {
  max-width: 7.2em;
  font-size: clamp(2.25rem, 4.6vw, 4.45rem);
  font-weight: 930;
  line-height: 0.92;
}

.pulse-copy > p:not(.eyebrow) {
  max-width: 34rem;
  font-size: 1.04rem;
}

.pulse-meta {
  margin-top: 4px;
}

.pulse-meta span {
  min-height: 34px;
  padding-inline: 12px;
}

.heart-button {
  width: 174px;
  height: 174px;
  justify-self: center;
}

.heart-button .icon {
  width: 58px;
  height: 58px;
}

.mood-widget {
  grid-column: span 4;
  min-height: 328px;
}

.mood-widget .widget-heading {
  align-items: flex-start;
}

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

.mood-chip {
  min-height: 76px;
  font-size: 0.95rem;
}

.safe-widget,
.countdown-widget,
.memory-widget {
  grid-column: span 4;
}

.question-widget {
  grid-column: span 8;
}

.activity-widget {
  grid-column: span 4;
}

.widget h2,
.tool-panel h2,
.modal-card h2,
.lock-card h2 {
  font-weight: 900;
}

.widget .eyebrow,
.tool-panel .eyebrow,
.modal-card .eyebrow,
.lock-card .eyebrow,
.today-panel .eyebrow {
  color: rgba(38, 34, 32, 0.52);
}

.widget-heading {
  margin-bottom: 18px;
}

.mini-badge {
  min-height: 32px;
}

.safe-widget {
  align-content: space-between;
}

.safe-widget .soft-button {
  justify-self: start;
}

.question-form {
  margin-top: 18px;
}

.answer-list {
  gap: 10px;
}

.countdown-number {
  margin-top: 20px;
  font-size: clamp(3.2rem, 6vw, 5rem);
  font-weight: 940;
  color: #cf6070;
}

.memory-preview {
  margin-top: 4px;
}

.memory-thumb {
  border-radius: 10px;
}

.activity-widget {
  gap: 14px;
}

.rhythm-line {
  font-size: 1rem;
}

.rhythm-nudge,
.reminder-strip {
  padding: 12px;
}

.activity-row {
  padding-top: 8px;
  border-top: 1px solid rgba(38, 34, 32, 0.08);
}

.activity-row:first-of-type {
  border-top: 0;
}

.today-panel {
  color: var(--ink-soft);
}

.mini-profile {
  padding-bottom: 8px;
}

.mini-profile h2 {
  color: var(--text);
  font-size: 1.06rem;
}

.now-list {
  gap: 0;
}

.now-item {
  min-height: 82px;
  padding: 15px 0;
}

.now-item .icon {
  color: var(--teal);
}

.chat-layout {
  min-height: calc(100vh - 150px);
  padding: 16px;
  border-color: rgba(38, 34, 32, 0.1);
}

.chat-status-bar {
  min-height: 68px;
}

.message-list {
  min-height: 460px;
  padding: 16px 10px 10px;
}

.message {
  max-width: min(640px, 78%);
  padding: 13px 15px;
}

.message.mine {
  box-shadow:
    0 18px 34px rgba(31, 113, 105, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.message.theirs {
  box-shadow:
    0 16px 34px rgba(53, 42, 35, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.composer {
  padding: 12px;
}

.split-layout {
  grid-template-columns: minmax(270px, 330px) minmax(0, 1fr);
  gap: 22px;
}

.tool-panel {
  padding: 20px;
}

.timeline,
.letter-grid,
.plan-grid {
  gap: 14px;
}

.timeline-item {
  grid-template-columns: 116px minmax(0, 1fr) auto;
  padding: 16px;
}

.timeline-item .memory-thumb {
  width: 116px;
}

.letter-grid,
.plan-grid {
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
}

.letter-card,
.plan-card {
  min-height: 230px;
  padding: 18px;
}

.letter-card::before,
.plan-card::before {
  height: 3px;
  opacity: 0.8;
}

.lock-card {
  width: min(460px, 100%);
  padding: 28px;
}

.lock-card .brand-lockup {
  margin-bottom: 2px;
}

.lock-form {
  gap: 16px;
}

.modal-card {
  padding: 22px;
}

.settings-modal-card,
.activity-modal-card,
.recap-modal-card {
  width: min(820px, calc(100vw - 36px));
}

.recap-hero {
  border-color: rgba(199, 92, 107, 0.18);
  background:
    linear-gradient(135deg, rgba(244, 220, 224, 0.78), rgba(255, 253, 248, 0.84) 52%, rgba(220, 239, 234, 0.64));
}

@media (max-width: 1180px) {
  .pulse-widget,
  .mood-widget,
  .safe-widget,
  .question-widget,
  .countdown-widget,
  .memory-widget,
  .activity-widget {
    grid-column: span 6;
  }

  .pulse-widget {
    grid-template-columns: minmax(0, 1fr) 160px;
  }

  .mood-widget {
    min-height: 260px;
  }
}

@media (max-width: 840px) {
  .app-shell {
    padding: 16px;
  }

  .topbar {
    min-height: 76px;
    padding: 8px 2px 12px;
    border-bottom: 0;
    background:
      linear-gradient(180deg, rgba(248, 242, 234, 0.98), rgba(248, 242, 234, 0.78) 72%, transparent);
  }

  .topbar h1 {
    font-size: clamp(1.9rem, 8vw, 2.55rem);
  }

  .home-grid {
    gap: 14px;
  }

  .pulse-widget,
  .mood-widget,
  .safe-widget,
  .question-widget,
  .countdown-widget,
  .memory-widget,
  .activity-widget {
    grid-column: auto;
  }

  .pulse-widget,
  .mood-widget {
    min-height: auto;
  }

  .pulse-widget {
    grid-template-columns: 1fr;
    padding: 22px;
  }

  .pulse-copy h2 {
    max-width: 8em;
    font-size: clamp(2rem, 11vw, 3.4rem);
  }

  .heart-button {
    width: 136px;
    height: 136px;
    margin-top: 10px;
  }

  .mood-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chat-layout {
    min-height: calc(100vh - 136px);
  }

  .split-layout {
    gap: 16px;
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding: 10px;
  }

  .widget,
  .pulse-widget {
    padding: 16px;
  }

  .top-actions {
    gap: 6px;
  }

  .icon-button,
  .send-button {
    width: 42px;
    height: 42px;
    min-width: 42px;
  }

  .mood-chip {
    min-height: 70px;
  }

  .message {
    max-width: 94%;
  }
}

.lock-card {
  padding: 22px;
}

/* Brand logo integration */
.brand-mark {
  flex: 0 0 auto;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 171, 204, 0.22), transparent 28%),
    url("assets/ourworld-logo.png") center / cover no-repeat;
  border: 1px solid rgba(255, 198, 220, 0.18);
  border-radius: 12px;
  box-shadow:
    0 18px 36px rgba(20, 10, 38, 0.18),
    0 0 0 5px rgba(255, 255, 255, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.sidebar .brand-mark {
  width: 44px;
  height: 44px;
}

.lock-card .brand-mark {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  box-shadow:
    0 20px 42px rgba(20, 10, 38, 0.2),
    0 0 0 6px rgba(255, 255, 255, 0.44),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.brand-lockup {
  color: var(--text);
}

.brand-name {
  letter-spacing: 0;
}

@media (max-width: 840px) {
  .lock-card .brand-mark {
    width: 46px;
    height: 46px;
  }
}

/* Mockup composition pass */
body {
  padding: 14px;
}

.app-shell {
  min-height: calc(100vh - 28px);
  min-height: calc(100dvh - 28px);
  border: 1px solid rgba(50, 36, 28, 0.1);
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(255, 246, 239, 0.92) 0, rgba(255, 250, 245, 0.72) 18%, rgba(255, 253, 248, 0.88) 44%, rgba(250, 243, 236, 0.86) 100%),
    var(--surface);
  box-shadow:
    0 34px 90px rgba(54, 41, 32, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.sidebar,
.today-panel {
  min-height: calc(100vh - 78px);
  min-height: calc(100dvh - 78px);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.sidebar {
  padding: 22px 8px 18px;
  border-right: 1px solid rgba(50, 36, 28, 0.08);
}

.today-panel {
  padding: 0 0 18px;
}

.sidebar::before,
.today-panel::before,
.widget::before,
.tool-panel::before,
.chat-layout::before {
  display: none;
}

.brand-lockup {
  align-items: flex-start;
}

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

.brand-name,
.topbar h1,
.pulse-copy h2,
.widget h2,
.today-panel h2,
.lock-card h2,
.modal-card h2 {
  font-family: Georgia, "Times New Roman", serif;
}

.brand-name {
  font-size: 1.32rem;
  font-weight: 700;
  line-height: 1;
}

.brand-subtitle {
  color: rgba(54, 41, 32, 0.58);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
  line-height: 1.15;
}

.sidebar .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  box-shadow:
    0 10px 24px rgba(20, 10, 38, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.person-switch {
  margin-top: 14px;
}

.main-nav {
  gap: 13px;
  margin-top: 8px;
}

.nav-item {
  min-height: 50px;
  padding: 0 16px;
  color: #4e3f38;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-weight: 650;
}

.nav-item:hover,
.nav-item.active {
  border-color: transparent;
  background:
    linear-gradient(90deg, rgba(244, 220, 214, 0.7), rgba(255, 249, 244, 0.58));
  box-shadow: none;
}

.nav-item.active::before {
  display: none;
}

.nav-item.active .icon {
  color: #cf5d55;
}

.sidebar-couple-card,
.sidebar-quote-card {
  display: grid;
  margin-top: auto;
  border: 1px solid rgba(50, 36, 28, 0.1);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.72), rgba(255, 246, 239, 0.56));
  box-shadow: 0 18px 46px rgba(54, 41, 32, 0.07);
}

.sidebar-couple-card {
  grid-template-columns: 40px 1fr 40px;
  gap: 10px;
  align-items: center;
  padding: 16px;
}

.sidebar-couple-card > div {
  grid-column: 1 / -1;
  display: grid;
  gap: 5px;
  justify-items: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.sidebar-couple-card strong {
  color: var(--text);
  font-size: 0.9rem;
}

.sidebar-heart {
  display: grid;
  place-items: center;
  color: #d8615f;
}

.sidebar-quote-card {
  gap: 8px;
  margin-top: 14px;
  padding: 18px;
  color: rgba(54, 41, 32, 0.62);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.55;
  text-align: center;
}

.sidebar-quote-card .quote-mark {
  color: rgba(207, 93, 85, 0.5);
  font-size: 2rem;
  line-height: 0.8;
}

.sidebar-quote-card .icon {
  justify-self: center;
  color: #d8615f;
  width: 16px;
  height: 16px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  padding: 4px 0 18px;
}

.topbar > div:first-child {
  display: flex;
  gap: 28px;
  align-items: baseline;
}

.topbar .eyebrow {
  order: 2;
  text-transform: none;
  color: rgba(54, 41, 32, 0.58);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.94rem;
  font-weight: 500;
}

.topbar h1 {
  order: 1;
  font-size: clamp(2.15rem, 3.8vw, 3.55rem);
  font-weight: 500;
}

.home-grid {
  gap: 22px;
}

.pulse-widget {
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) minmax(440px, 0.9fr);
  min-height: 304px;
  padding: 34px 42px;
  border-color: rgba(50, 36, 28, 0.12);
  background:
    linear-gradient(110deg, rgba(255, 250, 245, 0.96), rgba(255, 252, 248, 0.88) 46%, rgba(255, 246, 239, 0.82)),
    radial-gradient(circle at 62% 48%, rgba(244, 220, 224, 0.68), transparent 28%);
  box-shadow:
    0 22px 54px rgba(54, 41, 32, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.pulse-widget::after {
  inset: 18px;
  border-color: rgba(199, 92, 107, 0.12);
}

.pulse-copy h2 {
  max-width: 10em;
  font-size: clamp(2.35rem, 4vw, 4.2rem);
  font-weight: 500;
  line-height: 1.02;
}

.pulse-copy > p:not(.eyebrow) {
  color: rgba(54, 41, 32, 0.62);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.02rem;
}

.pulse-meta {
  margin-top: 12px;
}

.pulse-meta span {
  border: 0;
  background: rgba(255, 235, 229, 0.72);
  color: rgba(88, 58, 49, 0.8);
}

.pulse-visual {
  position: relative;
  display: grid;
  min-height: 236px;
  place-items: center;
}

.pulse-path {
  position: absolute;
  inset: 46px 28px 56px;
  border-top: 1px dashed rgba(210, 102, 102, 0.34);
  border-radius: 50%;
  transform: rotate(-3deg);
}

.pulse-path::before,
.pulse-path::after {
  position: absolute;
  color: rgba(218, 92, 92, 0.55);
  content: "♥";
  font-size: 0.9rem;
}

.pulse-path::before {
  left: 12%;
  top: -18px;
}

.pulse-path::after {
  right: 10%;
  top: -10px;
}

.pulse-person {
  position: absolute;
  display: grid;
  gap: 6px;
  justify-items: center;
  color: rgba(54, 41, 32, 0.62);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.82rem;
}

.pulse-person .avatar {
  width: 48px;
  height: 48px;
  box-shadow: 0 10px 24px rgba(54, 41, 32, 0.14);
}

.pulse-person-me {
  left: 8%;
  top: 44%;
}

.pulse-person-partner {
  right: 8%;
  top: 44%;
}

.heart-button {
  width: 148px;
  height: 148px;
  box-shadow:
    0 28px 54px rgba(207, 93, 85, 0.28),
    0 0 0 16px rgba(255, 236, 232, 0.78),
    0 0 0 34px rgba(255, 236, 232, 0.42),
    inset 0 -10px 22px rgba(112, 42, 42, 0.16);
}

.pulse-send-label {
  position: absolute;
  bottom: 10px;
  color: #d7574e;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.28rem;
  font-weight: 500;
}

.widget,
.chat-layout,
.tool-panel,
.timeline-item,
.letter-card,
.plan-card {
  border-color: rgba(50, 36, 28, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.84), rgba(255, 248, 242, 0.62));
  box-shadow:
    0 20px 48px rgba(54, 41, 32, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.mood-widget,
.safe-widget,
.countdown-widget,
.memory-widget,
.question-widget {
  grid-column: span 3;
  min-height: 236px;
}

.activity-widget {
  grid-column: span 4;
  min-height: 260px;
}

.question-widget {
  grid-column: span 5;
}

.mood-widget {
  grid-column: span 4;
}

.mood-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mood-chip {
  min-height: 58px;
}

.chat-preview-widget {
  grid-column: 1 / -1;
  min-height: 218px;
}

.home-chat-preview {
  display: grid;
  gap: 10px;
}

.home-chat-line {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.home-chat-line p {
  min-height: 38px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 243, 235, 0.78);
  color: var(--text);
  line-height: 1.35;
}

.home-chat-line.mine p {
  background: rgba(220, 239, 234, 0.78);
}

.home-chat-line time {
  color: rgba(54, 41, 32, 0.48);
  font-size: 0.8rem;
}

.home-chat-empty {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 62px;
  color: rgba(54, 41, 32, 0.58);
}

.private-room-hero {
  position: relative;
  overflow: hidden;
  min-height: 190px;
  padding: 22px;
  border-radius: 14px 14px 0 0;
  background:
    radial-gradient(circle at 70% 35%, rgba(255, 196, 132, 0.16), transparent 22%),
    linear-gradient(145deg, #0e3c3e, #073134 56%, #0b2a2e);
  color: #fffaf3;
  box-shadow: 0 24px 52px rgba(7, 49, 52, 0.22);
}

.private-room-hero > .icon {
  position: absolute;
  top: 18px;
  right: 18px;
  color: #f0a24d;
}

.private-room-hero .eyebrow {
  color: rgba(255, 250, 243, 0.82);
}

.private-room-hero h2 {
  max-width: 10rem;
  margin-top: 10px;
  color: #fffaf3;
  font-size: 1.28rem;
  line-height: 1.25;
}

.moon-scene {
  position: absolute;
  right: 36px;
  bottom: 30px;
  width: 74px;
  height: 74px;
}

.moon-scene::before {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(145deg, #f4c78b, #ad7b4d);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
  content: "";
}

.moon-scene::after {
  position: absolute;
  inset: -6px 0 6px 24px;
  border-radius: 50%;
  background: #073134;
  content: "";
}

.mini-profile,
.now-list,
.side-note-card {
  padding-inline: 18px;
}

.mini-profile {
  padding-top: 22px;
}

.now-item .icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(220, 239, 234, 0.58);
}

.side-note-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px;
  gap: 10px;
  margin: 18px;
  padding: 20px;
  border: 1px solid rgba(207, 93, 85, 0.16);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 232, 225, 0.82), rgba(255, 248, 242, 0.76));
  color: rgba(54, 41, 32, 0.68);
  line-height: 1.5;
}

.side-note-card strong {
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.02rem;
}

.side-note-card .icon {
  color: #d85d58;
}

.side-quote-card {
  display: grid;
  gap: 12px;
  justify-items: center;
  margin-top: auto;
  min-height: 170px;
  padding: 28px 22px;
  border-radius: 0 0 14px 14px;
  background: linear-gradient(145deg, #0e3c3e, #073134);
  color: #fffaf3;
  font-family: Georgia, "Times New Roman", serif;
  text-align: center;
}

.side-quote-card > span:first-child {
  color: rgba(255, 250, 243, 0.52);
  font-size: 2rem;
  line-height: 0.7;
}

.side-quote-card p {
  max-width: 12rem;
  line-height: 1.45;
}

.side-quote-card .icon {
  width: 16px;
  height: 16px;
}

@media (max-width: 1180px) {
  .pulse-widget {
    grid-template-columns: minmax(0, 1fr);
  }

  .pulse-visual {
    min-height: 250px;
  }

  .mood-widget,
  .safe-widget,
  .countdown-widget,
  .memory-widget,
  .question-widget,
  .activity-widget {
    grid-column: span 6;
  }
}

@media (max-width: 840px) {
  body {
    padding: 0;
  }

  .app-shell {
    min-height: 100vh;
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .sidebar-couple-card,
  .sidebar-quote-card {
    display: none;
  }

  .topbar > div:first-child {
    display: grid;
    gap: 4px;
  }

  .topbar .eyebrow {
    order: 1;
  }

  .topbar h1 {
    order: 2;
  }

  .pulse-widget {
    padding: 22px;
  }

  .pulse-person-me {
    left: 0;
  }

  .pulse-person-partner {
    right: 0;
  }

  .mood-widget,
  .safe-widget,
  .countdown-widget,
  .memory-widget,
  .question-widget,
  .activity-widget,
  .chat-preview-widget {
    grid-column: auto;
  }
}

@media (max-width: 520px) {
  .pulse-visual {
    min-height: 230px;
  }

  .pulse-person .avatar {
    width: 42px;
    height: 42px;
  }

  .heart-button {
    width: 126px;
    height: 126px;
  }

  .home-chat-line {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .home-chat-line time {
    grid-column: 2;
    justify-self: start;
  }
}

/* Mockup repair pass */
body {
  overflow-x: hidden;
  padding: 12px;
  background:
    linear-gradient(115deg, rgba(221, 239, 232, 0.8) 0, rgba(221, 239, 232, 0) 24%),
    linear-gradient(245deg, rgba(249, 219, 223, 0.76) 0, rgba(249, 219, 223, 0) 26%),
    linear-gradient(180deg, #fffaf5 0%, #f7efe7 46%, #eef5ef 100%);
}

.app-shell {
  width: min(100%, 1660px);
  max-width: 1660px;
  min-height: calc(100vh - 24px);
  min-height: calc(100dvh - 24px);
  grid-template-columns: 236px minmax(0, 1fr) 292px;
  gap: 24px;
  align-items: start;
  overflow: visible;
  padding: 22px;
  border: 1px solid rgba(55, 42, 32, 0.09);
  border-radius: 16px;
  background:
    linear-gradient(90deg, rgba(255, 247, 240, 0.94) 0, rgba(255, 251, 246, 0.82) 20%, rgba(255, 253, 248, 0.9) 52%, rgba(248, 240, 233, 0.88) 100%),
    var(--surface);
  box-shadow:
    0 34px 90px rgba(54, 41, 32, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.workspace {
  min-width: 0;
  max-width: 100%;
  padding: 0 0 42px;
}

.sidebar,
.today-panel {
  align-self: start;
  position: sticky;
  top: 22px;
  min-height: calc(100vh - 68px);
  min-height: calc(100dvh - 68px);
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.sidebar {
  gap: 22px;
  overflow: visible;
  padding: 22px 18px 20px 0;
  border: 0;
  border-right: 1px solid rgba(55, 42, 32, 0.08);
  background: transparent;
}

.today-panel {
  gap: 0;
  overflow: hidden;
  padding: 0 0 18px;
  border: 1px solid rgba(55, 42, 32, 0.09);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.92), rgba(255, 247, 240, 0.74)),
    var(--surface);
  box-shadow:
    0 26px 64px rgba(54, 41, 32, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.brand-lockup {
  align-items: center;
  gap: 12px;
}

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

.brand-name,
.topbar h1,
.pulse-copy h2,
.widget h2,
.today-panel h2,
.lock-card h2,
.modal-card h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}

.brand-name {
  font-size: 1.34rem;
  line-height: 1;
}

.brand-subtitle {
  color: rgba(54, 41, 32, 0.58);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.94rem;
  line-height: 1.1;
}

.sidebar .brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  box-shadow:
    0 12px 28px rgba(22, 11, 48, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.person-switch {
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
  padding: 6px;
  border-color: rgba(55, 42, 32, 0.08);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.66);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.person-option {
  min-height: 48px;
  border-radius: 8px;
  color: rgba(54, 41, 32, 0.56);
}

.person-option.active {
  border-color: rgba(207, 93, 85, 0.3);
  background:
    linear-gradient(135deg, rgba(255, 225, 223, 0.86), rgba(255, 253, 248, 0.74));
  box-shadow: 0 12px 28px rgba(207, 93, 85, 0.1);
}

.main-nav {
  gap: 14px;
  margin-top: 2px;
}

.nav-item {
  position: relative;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: rgba(54, 41, 32, 0.66);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.02rem;
  font-weight: 600;
}

.nav-item:hover,
.nav-item.active {
  background:
    linear-gradient(90deg, rgba(255, 225, 218, 0.78), rgba(255, 250, 245, 0.8));
  box-shadow: 0 16px 34px rgba(54, 41, 32, 0.06);
}

.nav-item.active {
  color: var(--text);
}

.nav-item.active::before {
  display: block;
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--teal), var(--rose));
  content: "";
}

.sidebar-couple-card,
.sidebar-quote-card {
  border: 1px solid rgba(55, 42, 32, 0.09);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.8), rgba(255, 247, 240, 0.62));
  box-shadow: 0 18px 46px rgba(54, 41, 32, 0.06);
}

.sidebar-couple-card {
  margin-top: auto;
  padding: 16px;
}

.sidebar-quote-card {
  margin-top: 0;
  padding: 18px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  min-height: auto;
  margin: 0 0 24px;
  padding: 4px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.topbar > div:first-child {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: baseline;
}

.topbar h1 {
  order: 1;
  font-size: clamp(2.15rem, 3.2vw, 3.35rem);
  line-height: 0.98;
}

.topbar .eyebrow {
  order: 2;
  color: rgba(54, 41, 32, 0.54);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.95rem;
  font-weight: 500;
  text-transform: none;
}

.top-actions {
  align-self: start;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-flow: row;
  grid-auto-rows: auto;
  gap: 22px;
  align-items: stretch;
}

.home-grid > * {
  min-width: 0;
}

.widget,
.pulse-widget {
  min-height: 0;
  border-color: rgba(55, 42, 32, 0.1);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.88), rgba(255, 248, 242, 0.72));
  box-shadow:
    0 22px 54px rgba(54, 41, 32, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.pulse-widget {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 42%);
  gap: 28px;
  align-items: center;
  min-height: 278px;
  overflow: hidden;
  padding: 34px 38px;
  background:
    radial-gradient(circle at 70% 44%, rgba(255, 226, 224, 0.94), transparent 25%),
    radial-gradient(circle at 91% 45%, rgba(221, 239, 232, 0.78), transparent 24%),
    linear-gradient(110deg, rgba(255, 250, 245, 0.98), rgba(255, 253, 248, 0.86) 47%, rgba(255, 247, 240, 0.86));
}

.pulse-widget::after {
  inset: 18px;
  border-color: rgba(207, 93, 85, 0.13);
}

.pulse-copy {
  position: relative;
  z-index: 2;
  max-width: 620px;
}

.pulse-copy h2 {
  max-width: 10em;
  font-size: clamp(2.35rem, 4vw, 4rem);
  line-height: 1.02;
}

.pulse-copy > p:not(.eyebrow) {
  color: rgba(54, 41, 32, 0.62);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.02rem;
}

.pulse-meta {
  margin-top: 10px;
}

.pulse-meta span {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 235, 229, 0.76);
  color: rgba(88, 58, 49, 0.78);
}

.pulse-visual {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 220px;
  place-items: center;
  overflow: visible;
}

.pulse-path {
  position: absolute;
  left: 28px;
  right: 28px;
  top: 72px;
  height: 84px;
  border-top: 1px dashed rgba(207, 93, 85, 0.32);
  border-radius: 50%;
  transform: rotate(-4deg);
}

.pulse-path::before,
.pulse-path::after {
  position: absolute;
  color: rgba(216, 93, 88, 0.6);
  content: "\\2665";
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
}

.pulse-path::before {
  left: 13%;
  top: -20px;
}

.pulse-path::after {
  right: 10%;
  top: -12px;
}

.pulse-person {
  position: absolute;
  z-index: 2;
  gap: 6px;
  color: rgba(54, 41, 32, 0.62);
  font-family: Georgia, "Times New Roman", serif;
}

.pulse-person .avatar {
  width: 48px;
  height: 48px;
  box-shadow: 0 12px 24px rgba(54, 41, 32, 0.14);
}

.pulse-person-me {
  left: 5%;
  top: 46%;
}

.pulse-person-partner {
  right: 5%;
  top: 46%;
}

.heart-button {
  z-index: 3;
  width: 150px;
  height: 150px;
  color: #fff;
  background:
    linear-gradient(145deg, #f49883, #cf5d64 58%, #bd4f60);
  box-shadow:
    0 30px 56px rgba(207, 93, 85, 0.3),
    0 0 0 16px rgba(255, 235, 229, 0.86),
    0 0 0 34px rgba(255, 235, 229, 0.44),
    inset 0 -10px 22px rgba(91, 32, 38, 0.17);
}

.heart-button .icon {
  width: 56px;
  height: 56px;
}

.pulse-send-label {
  position: absolute;
  bottom: 0;
  z-index: 3;
  color: #d7574e;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.26rem;
  font-weight: 500;
}

.mood-widget,
.safe-widget,
.question-widget {
  grid-column: span 4;
  min-height: 232px;
}

.countdown-widget,
.memory-widget {
  grid-column: span 3;
  min-height: 238px;
}

.activity-widget {
  grid-column: span 6;
  min-height: 238px;
}

.chat-preview-widget {
  grid-column: 1 / -1;
  min-height: 190px;
}

.widget {
  position: relative;
  overflow: hidden;
  padding: 22px;
}

.widget::after {
  position: absolute;
  inset: auto -44px -58px auto;
  width: 140px;
  height: 140px;
  border: 1px solid rgba(207, 93, 85, 0.1);
  border-radius: 999px;
  content: "";
  pointer-events: none;
}

.widget > * {
  position: relative;
  z-index: 1;
}

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

.mood-chip {
  min-height: 56px;
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.68);
}

.mood-chip.active {
  background: rgba(221, 239, 232, 0.84);
  box-shadow: inset 0 0 0 1px rgba(31, 113, 105, 0.18);
}

.safe-widget {
  align-content: space-between;
}

.safe-widget .soft-button,
.question-form,
.home-chat-line p {
  border-radius: 10px;
}

.question-form {
  grid-template-columns: minmax(0, 1fr) 44px;
}

.question-form input {
  min-width: 0;
}

.countdown-number {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
}

.memory-preview {
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 14px;
  min-height: 112px;
}

.memory-thumb {
  width: 104px;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 42%),
    linear-gradient(145deg, #11484b, #072f33);
  box-shadow:
    0 18px 32px rgba(7, 49, 52, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.memory-copy strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.04rem;
}

.activity-widget {
  gap: 11px;
}

.activity-row {
  padding: 9px 0;
  border-top: 1px solid rgba(55, 42, 32, 0.08);
}

.chat-preview-widget {
  padding: 20px 22px 18px;
}

.home-chat-preview {
  display: grid;
  gap: 10px;
}

.home-chat-line {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.home-chat-line p {
  min-width: 0;
  min-height: 38px;
  padding: 10px 14px;
  background: rgba(255, 243, 235, 0.82);
  color: var(--text);
  line-height: 1.35;
}

.home-chat-line.mine p {
  background: rgba(221, 239, 232, 0.82);
}

.home-chat-line time {
  color: rgba(54, 41, 32, 0.48);
  font-size: 0.8rem;
  white-space: nowrap;
}

.home-chat-empty {
  min-height: 64px;
  align-items: center;
}

.private-room-hero {
  position: relative;
  min-height: 202px;
  margin: 0;
  padding: 24px;
  border-radius: 14px 14px 0 0;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 224, 171, 0.14) 0 2px, transparent 3px),
    radial-gradient(circle at 82% 22%, rgba(255, 224, 171, 0.16) 0 2px, transparent 3px),
    radial-gradient(circle at 22% 62%, rgba(255, 224, 171, 0.16) 0 1px, transparent 3px),
    linear-gradient(145deg, #0e3f40, #083437 58%, #072b2f);
  color: #fffaf3;
  box-shadow: 0 24px 52px rgba(7, 49, 52, 0.22);
}

.private-room-hero > * {
  position: relative;
  z-index: 1;
}

.private-room-hero > .icon {
  position: absolute;
  top: 20px;
  right: 20px;
  color: #f0a24d;
}

.private-room-hero .eyebrow {
  color: rgba(255, 250, 243, 0.82);
}

.private-room-hero h2 {
  max-width: 11rem;
  margin-top: 10px;
  color: #fffaf3;
  font-size: 1.22rem;
  line-height: 1.26;
}

.moon-scene {
  position: absolute;
  right: 34px;
  bottom: 30px;
  z-index: 0;
  width: 82px;
  height: 82px;
}

.moon-scene::before {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 241, 210, 0.75), transparent 0 8px),
    linear-gradient(145deg, #f5d4a3, #b9875d);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
  content: "";
}

.moon-scene::after {
  position: absolute;
  inset: -7px -2px 7px 30px;
  border-radius: 50%;
  background: #083437;
  content: "";
}

.mini-profile,
.now-list {
  padding-inline: 20px;
}

.mini-profile {
  padding-top: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(55, 42, 32, 0.1);
}

.now-list {
  gap: 0;
  padding-top: 8px;
}

.now-item {
  padding: 17px 0;
  border-bottom: 1px solid rgba(55, 42, 32, 0.1);
}

.now-item .icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(221, 239, 232, 0.72);
  color: var(--teal);
}

.side-note-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px;
  gap: 10px;
  margin: 18px 18px 0;
  padding: 20px;
  border: 1px solid rgba(207, 93, 85, 0.16);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 232, 225, 0.9), rgba(255, 248, 242, 0.78));
  color: rgba(54, 41, 32, 0.68);
  line-height: 1.48;
}

.side-note-card strong {
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
}

.side-note-card .icon {
  color: #d85d58;
}

.side-quote-card {
  display: grid;
  gap: 12px;
  justify-items: center;
  margin: 24px 0 -18px;
  min-height: 184px;
  padding: 34px 22px;
  border-radius: 0 0 14px 14px;
  background:
    radial-gradient(circle at 45% 22%, rgba(255, 224, 171, 0.12), transparent 22%),
    linear-gradient(145deg, #0e3f40, #073134);
  color: #fffaf3;
  font-family: Georgia, "Times New Roman", serif;
  text-align: center;
}

.side-quote-card > span:first-child {
  color: rgba(255, 250, 243, 0.5);
  font-size: 2rem;
  line-height: 0.7;
}

.side-quote-card p {
  max-width: 12rem;
  line-height: 1.46;
}

.letter-card::after {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 96px;
  height: 64px;
  border: 1px solid rgba(207, 93, 85, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, transparent 49%, rgba(207, 93, 85, 0.16) 50%, transparent 51%),
    linear-gradient(45deg, transparent 49%, rgba(207, 93, 85, 0.12) 50%, transparent 51%),
    linear-gradient(180deg, rgba(255, 238, 231, 0.86), rgba(255, 248, 242, 0.74));
  box-shadow: 0 14px 24px rgba(54, 41, 32, 0.08);
  content: "";
  opacity: 0.65;
  transform: rotate(-7deg);
}

.letter-card > *,
.plan-card > * {
  position: relative;
  z-index: 1;
}

@media (max-width: 1320px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr) 270px;
    gap: 18px;
    padding: 18px;
  }

  .pulse-widget {
    grid-template-columns: minmax(0, 1fr);
  }

  .pulse-visual {
    min-height: 238px;
  }

  .mood-widget,
  .safe-widget,
  .question-widget,
  .countdown-widget,
  .memory-widget,
  .activity-widget {
    grid-column: span 6;
  }
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .today-panel {
    grid-column: 1 / -1;
    position: relative;
    top: auto;
    min-height: 0;
  }

  .private-room-hero {
    min-height: 176px;
  }
}

@media (max-width: 840px) {
  body {
    padding: 0;
  }

  .app-shell {
    display: block;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 16px;
    border: 0;
    border-radius: 0;
  }

  .sidebar {
    position: relative;
    top: auto;
    min-height: auto;
    margin-bottom: 18px;
    padding: 0 0 16px;
    border-right: 0;
    border-bottom: 1px solid rgba(55, 42, 32, 0.08);
  }

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

  .topbar {
    margin-bottom: 18px;
  }

  .topbar > div:first-child {
    display: grid;
    gap: 4px;
  }

  .topbar .eyebrow {
    order: 1;
  }

  .topbar h1 {
    order: 2;
  }

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

  .pulse-widget,
  .mood-widget,
  .safe-widget,
  .question-widget,
  .countdown-widget,
  .memory-widget,
  .activity-widget,
  .chat-preview-widget {
    grid-column: 1 / -1;
  }

  .pulse-widget {
    padding: 24px;
  }

  .today-panel {
    margin-top: 18px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 12px;
  }

  .person-switch,
  .main-nav {
    grid-template-columns: 1fr;
  }

  .pulse-copy h2 {
    font-size: 2.25rem;
  }

  .pulse-visual {
    min-height: 218px;
  }

  .pulse-person-me {
    left: 0;
  }

  .pulse-person-partner {
    right: 0;
  }

  .heart-button {
    width: 126px;
    height: 126px;
  }

  .home-chat-line {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .home-chat-line time {
    grid-column: 2;
    justify-self: start;
  }
}

/* Avatar system */
.avatar {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.avatar-initial {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.avatar-image {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar.has-image {
  background: #fffaf4;
  color: transparent;
}

.avatar.has-image::after {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.34),
    inset 0 -10px 18px rgba(31, 22, 18, 0.08);
  content: "";
  pointer-events: none;
}

.avatar-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.avatar-picker {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 82px;
  padding: 10px 12px;
  border: 1px solid rgba(55, 42, 32, 0.11);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 236, 232, 0.76), rgba(255, 253, 248, 0.78) 48%, rgba(221, 239, 232, 0.56));
  color: var(--text);
  text-align: left;
  box-shadow:
    0 16px 34px rgba(54, 41, 32, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.avatar-picker:hover {
  transform: translateY(-1px);
  box-shadow:
    0 20px 42px rgba(54, 41, 32, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.avatar-picker:disabled {
  cursor: not-allowed;
  transform: none;
  opacity: 0.62;
}

.avatar-preview {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  font-size: 1.25rem;
  box-shadow:
    0 16px 30px rgba(54, 41, 32, 0.13),
    0 0 0 5px rgba(255, 255, 255, 0.54);
}

.avatar-picker span:not(.avatar) {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.avatar-picker strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.03rem;
  font-weight: 600;
}

.avatar-picker small {
  color: rgba(54, 41, 32, 0.62);
  font-size: 0.83rem;
  line-height: 1.35;
}

.avatar-remove-button {
  align-self: center;
  min-height: 44px;
  margin-top: 0;
  white-space: nowrap;
}

.avatar-editor.is-disabled .avatar-picker,
.avatar-editor.is-disabled .avatar-remove-button {
  opacity: 0.58;
}

.settings-account-card > .avatar {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
}

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

.message-author > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-avatar {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  font-size: 0.68rem;
  box-shadow: 0 6px 12px rgba(31, 22, 18, 0.14);
}

.message.mine .message-avatar {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.24),
    0 6px 12px rgba(0, 0, 0, 0.16);
}

.home-chat-line .avatar {
  box-shadow: 0 8px 16px rgba(31, 22, 18, 0.12);
}

@media (max-width: 620px) {
  .avatar-editor {
    grid-template-columns: 1fr;
  }

  .avatar-remove-button {
    justify-self: start;
  }
}

/* Chat composer and reactions repair */
.composer {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 10px;
  align-items: center;
  padding: 10px;
}

.composer > .visually-hidden {
  position: absolute;
  inset: auto;
}

#chat-image-button {
  grid-column: 1;
  grid-row: 1;
}

#chat-input {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

#chat-submit-button {
  grid-column: 3;
  grid-row: 1;
}

.message-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px 10px;
  align-items: center;
}

.reaction-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 32px;
  gap: 6px;
  max-width: min(100%, 520px);
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding: 2px;
  scrollbar-width: none;
}

.reaction-row::-webkit-scrollbar {
  display: none;
}

.reaction-button {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(55, 42, 32, 0.08);
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.78);
  color: var(--text);
  font-family:
    "Apple Color Emoji",
    "Segoe UI Emoji",
    "Noto Color Emoji",
    system-ui,
    sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1;
  box-shadow: 0 8px 16px rgba(54, 41, 32, 0.08);
}

.reaction-button:hover {
  transform: translateY(-1px) scale(1.05);
  background: #fff;
}

.reaction-button.active {
  border-color: rgba(207, 93, 85, 0.34);
  background: rgba(255, 231, 232, 0.96);
  box-shadow:
    0 10px 20px rgba(207, 93, 85, 0.14),
    inset 0 0 0 2px rgba(255, 255, 255, 0.68);
}

.message.mine .reaction-button {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.18);
  box-shadow: none;
}

.message.mine .reaction-button.active {
  background: rgba(255, 255, 255, 0.32);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.message-action-row {
  justify-content: flex-end;
}

@media (max-width: 620px) {
  .message-footer {
    grid-template-columns: minmax(0, 1fr);
  }

  .message-action-row {
    justify-content: flex-start;
  }
}

/* Instagram-style message reactions */
.message {
  position: relative;
  overflow: visible;
}

.message.reactions-open {
  z-index: 30;
}

.message-footer {
  position: absolute;
  top: 50%;
  z-index: 6;
  display: flex;
  width: max-content;
  max-width: none;
  align-items: center;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%);
  transition: opacity 120ms ease, transform 120ms ease;
}

.message:hover .message-footer,
.message:focus-within .message-footer,
.message.reactions-open .message-footer {
  opacity: 1;
  pointer-events: auto;
}

.message.mine .message-footer {
  right: calc(100% + 8px);
}

.message.theirs .message-footer {
  left: calc(100% + 8px);
}

.message-action-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 3px;
  align-items: center;
  padding: 4px;
  border: 1px solid rgba(55, 42, 32, 0.09);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: 0 16px 34px rgba(54, 41, 32, 0.14);
  backdrop-filter: blur(14px);
}

.message.mine .message-action-row {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(24, 32, 34, 0.84);
  box-shadow: 0 16px 34px rgba(12, 19, 20, 0.18);
}

.message-action {
  display: inline-grid;
  place-items: center;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(54, 41, 32, 0.66);
  font-size: 0;
}

.message-action:hover {
  background: rgba(55, 42, 32, 0.08);
  color: var(--text);
}

.message.mine .message-action {
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
}

.message.mine .message-action:hover {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
}

.message-action .icon {
  width: 17px;
  height: 17px;
}

.message-action.danger {
  color: var(--rose);
}

.message.mine .message-action.danger {
  color: rgba(255, 190, 190, 0.94);
}

.message-reaction-badge {
  justify-self: start;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 22px;
  margin: -2px 0 0;
  border: 1px solid rgba(55, 42, 32, 0.08);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.95);
  color: var(--text);
  font-family:
    "Apple Color Emoji",
    "Segoe UI Emoji",
    "Noto Color Emoji",
    system-ui,
    sans-serif;
  font-size: 0.9rem;
  line-height: 1;
  box-shadow: 0 10px 18px rgba(54, 41, 32, 0.13);
}

.message.mine .message-reaction-badge {
  background: rgba(255, 253, 248, 0.96);
}

.reaction-popover {
  position: absolute;
  bottom: calc(100% + 10px);
  z-index: 12;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 38px;
  gap: 4px;
  align-items: center;
  max-width: min(440px, calc(100vw - 48px));
  overflow-x: auto;
  padding: 7px;
  border: 1px solid rgba(55, 42, 32, 0.1);
  border-radius: 999px;
  background: rgba(24, 32, 34, 0.94);
  box-shadow:
    0 22px 50px rgba(24, 32, 34, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  scrollbar-width: none;
}

.reaction-popover::-webkit-scrollbar {
  display: none;
}

.message.mine .reaction-popover {
  right: 0;
}

.message.theirs .reaction-popover {
  left: 0;
}

.reaction-popover .reaction-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  color: #fff;
  font-family:
    "Apple Color Emoji",
    "Segoe UI Emoji",
    "Noto Color Emoji",
    system-ui,
    sans-serif;
  font-size: 1.25rem;
  line-height: 1;
}

.reaction-popover .reaction-button:hover,
.reaction-popover .reaction-button.active {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px) scale(1.1);
}

.reaction-row {
  display: none;
}

.message-seen {
  justify-self: end;
  margin-top: -2px;
  opacity: 0.68;
}

@media (max-width: 720px) {
  .message-footer {
    top: auto;
    bottom: calc(100% + 6px);
    transform: none;
  }

  .message.mine .message-footer {
    right: 0;
  }

  .message.theirs .message-footer {
    left: 0;
  }
}

/* Mobile app shell repair */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.app-shell,
.workspace,
.view,
.home-grid,
.split-layout,
.chat-layout,
.message-list,
.tool-panel,
.timeline,
.letter-grid,
.plan-grid,
.widget {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 840px) {
  html {
    overflow-x: hidden;
  }

  body {
    width: 100%;
    overflow-x: hidden;
    padding: 0 !important;
    overscroll-behavior-y: contain;
  }

  .app-shell {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    margin: 0 !important;
    padding: calc(10px + env(safe-area-inset-top)) 12px calc(86px + env(safe-area-inset-bottom)) !important;
    border: 0 !important;
    border-radius: 0 !important;
    overflow-x: hidden !important;
    background:
      linear-gradient(120deg, rgba(220, 239, 234, 0.64) 0%, transparent 32%),
      linear-gradient(245deg, rgba(244, 220, 224, 0.68) 0%, transparent 38%),
      linear-gradient(180deg, rgba(255, 252, 247, 0.98), rgba(248, 241, 234, 0.98));
    box-shadow: none !important;
  }

  .workspace,
  .view {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    overflow-x: hidden !important;
  }

  .today-panel {
    display: none !important;
  }

  .sidebar {
    position: fixed !important;
    inset: auto 0 0 0 !important;
    z-index: 1000 !important;
    display: block !important;
    width: 100% !important;
    height: calc(72px + env(safe-area-inset-bottom)) !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 8px max(10px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)) !important;
    border: 0 !important;
    border-top: 1px solid rgba(55, 42, 32, 0.12) !important;
    border-radius: 18px 18px 0 0 !important;
    background:
      linear-gradient(180deg, rgba(255, 253, 248, 0.94), rgba(255, 246, 239, 0.9)),
      var(--surface) !important;
    box-shadow: 0 -18px 44px rgba(54, 41, 32, 0.14) !important;
    backdrop-filter: blur(18px);
    overflow: visible !important;
  }

  .sidebar .brand-lockup,
  .sidebar .person-switch,
  .sidebar-couple-card,
  .sidebar-quote-card {
    display: none !important;
  }

  .main-nav {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 4px !important;
    width: 100% !important;
    height: 56px !important;
    margin: 0 !important;
    padding: 0 !important;
    align-items: center !important;
  }

  .nav-item {
    position: relative !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    place-items: center !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 56px !important;
    min-height: 56px !important;
    padding: 0 !important;
    border: 1px solid transparent !important;
    border-radius: 14px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: rgba(54, 41, 32, 0.62) !important;
    font-size: 0 !important;
  }

  .nav-item > span:not(.icon) {
    display: none !important;
  }

  .nav-item .icon {
    width: 23px !important;
    height: 23px !important;
  }

  .nav-item.active,
  .nav-item:hover {
    border-color: rgba(207, 93, 85, 0.22) !important;
    background:
      linear-gradient(135deg, rgba(255, 225, 218, 0.88), rgba(255, 253, 248, 0.82)) !important;
    color: var(--rose) !important;
  }

  .nav-item.active::before {
    display: none !important;
  }

  .nav-badge {
    position: absolute !important;
    top: 7px !important;
    right: calc(50% - 25px) !important;
    min-width: 18px !important;
    height: 18px !important;
    padding: 0 5px !important;
    font-size: 0.66rem !important;
  }

  .topbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 30 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 10px !important;
    align-items: end !important;
    width: 100% !important;
    margin: 0 0 12px !important;
    padding: 8px 0 10px !important;
    background:
      linear-gradient(180deg, rgba(255, 252, 247, 0.96), rgba(255, 252, 247, 0.82) 78%, transparent) !important;
    backdrop-filter: blur(14px);
  }

  .topbar > div:first-child {
    display: grid !important;
    gap: 2px !important;
    min-width: 0 !important;
  }

  .topbar .eyebrow {
    order: 1 !important;
    font-size: 0.9rem !important;
    line-height: 1.15 !important;
  }

  .topbar h1 {
    order: 2 !important;
    max-width: 100% !important;
    font-size: clamp(2.1rem, 10vw, 2.85rem) !important;
    line-height: 0.96 !important;
    overflow-wrap: normal !important;
  }

  .top-actions {
    display: flex !important;
    gap: 7px !important;
    align-items: center !important;
  }

  .top-actions .icon-button,
  .top-actions .soft-button {
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    min-height: 46px !important;
    padding: 0 !important;
  }

  .top-logout .logout-label {
    display: none !important;
  }

  .home-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
    width: 100% !important;
    overflow: hidden !important;
  }

  .home-grid > *,
  .pulse-widget,
  .mood-widget,
  .safe-widget,
  .question-widget,
  .countdown-widget,
  .memory-widget,
  .activity-widget,
  .chat-preview-widget {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .widget,
  .pulse-widget,
  .chat-layout,
  .tool-panel,
  .timeline-item,
  .letter-card,
  .plan-card {
    border-radius: 16px !important;
  }

  .widget,
  .pulse-widget {
    min-height: 0 !important;
    padding: 16px !important;
    overflow: hidden !important;
  }

  .pulse-widget {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
  }

  .pulse-copy h2 {
    font-size: clamp(2.55rem, 12vw, 3.25rem) !important;
    line-height: 0.98 !important;
  }

  .pulse-visual {
    min-height: 170px !important;
    max-height: 190px !important;
  }

  .heart-button {
    width: 112px !important;
    height: 112px !important;
  }

  .mood-options {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .mood-chip {
    min-height: 52px !important;
  }

  .memory-preview,
  .home-chat-line {
    grid-template-columns: 58px minmax(0, 1fr) !important;
  }

  .home-chat-line time {
    grid-column: 2 !important;
    justify-self: start !important;
  }

  .activity-widget {
    gap: 10px !important;
  }

  #home-activity-list {
    display: flex !important;
    flex-direction: column !important;
    max-height: 230px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  #home-activity-list .mini-activity-item,
  #home-activity-list .mini-activity-empty {
    position: static !important;
    display: grid !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    transform: none !important;
    opacity: 1 !important;
    filter: none !important;
  }

  #home-activity-list .mini-activity-item {
    grid-template-columns: 38px minmax(0, 1fr) !important;
    gap: 10px !important;
    padding: 12px !important;
  }

  .activity-row {
    display: flex !important;
    align-items: flex-start !important;
    min-height: 0 !important;
    padding: 8px 0 !important;
  }

  .activity-row strong {
    max-width: 58% !important;
    text-align: right !important;
  }

  .split-layout {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
    width: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .tool-panel {
    position: static !important;
    top: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 16px !important;
  }

  .form-grid-2 {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .tool-panel input,
  .tool-panel textarea,
  .tool-panel select {
    width: 100% !important;
    min-width: 0 !important;
  }

  .timeline,
  .letter-grid,
  .plan-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
    width: 100% !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .timeline-item {
    grid-template-columns: 76px minmax(0, 1fr) !important;
    gap: 12px !important;
    width: 100% !important;
  }

  .timeline-item .memory-thumb {
    width: 76px !important;
  }

  .timeline-item .timeline-actions {
    grid-column: 1 / -1 !important;
  }

  .letter-card,
  .plan-card {
    width: 100% !important;
    min-width: 0 !important;
  }

  #chat-view.active {
    min-height: 0 !important;
  }

  .chat-layout {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) auto auto auto !important;
    gap: 10px !important;
    width: 100% !important;
    height: calc(100vh - 148px - env(safe-area-inset-bottom)) !important;
    height: calc(100dvh - 148px - env(safe-area-inset-bottom)) !important;
    min-height: 500px !important;
    padding: 10px !important;
    overflow: hidden !important;
  }

  .chat-status-bar {
    min-height: 58px !important;
    padding: 10px !important;
  }

  #chat-presence-detail {
    max-width: 42% !important;
    font-size: 0.78rem !important;
  }

  .message-list {
    min-height: 0 !important;
    width: 100% !important;
    padding: 12px 8px 86px !important;
    overflow: auto !important;
    overscroll-behavior: contain;
  }

  .message {
    max-width: min(86%, 430px) !important;
    overflow: visible !important;
  }

  .message.mine {
    align-self: flex-end !important;
    margin-left: auto !important;
  }

  .message.theirs {
    align-self: flex-start !important;
    margin-right: auto !important;
  }

  .message-footer {
    top: auto !important;
    bottom: calc(100% + 8px) !important;
    left: auto !important;
    right: 0 !important;
    transform: none !important;
  }

  .message.reactions-open .message-footer,
  .message:focus-within .message-footer {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .message-action-row {
    max-width: calc(100vw - 36px) !important;
    overflow-x: auto !important;
  }

  .reaction-popover {
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    bottom: calc(84px + env(safe-area-inset-bottom)) !important;
    z-index: 1200 !important;
    display: flex !important;
    max-width: calc(100vw - 20px) !important;
    width: max-content !important;
    transform: translateX(-50%) !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }

  .reaction-popover .reaction-button {
    flex: 0 0 36px !important;
    width: 36px !important;
    min-width: 36px !important;
    height: 36px !important;
  }

  .composer {
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) 46px !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 8px !important;
  }

  .composer input {
    width: 100% !important;
    min-width: 0 !important;
    padding-right: 12px !important;
  }

  .chat-image-preview,
  .chat-draft-context {
    width: 100% !important;
    min-width: 0 !important;
  }
}

@media (max-width: 480px) {
  .app-shell {
    padding-right: 10px !important;
    padding-left: 10px !important;
  }

  .topbar h1 {
    font-size: clamp(2rem, 10vw, 2.55rem) !important;
  }

  .top-actions {
    gap: 5px !important;
  }

  .top-actions .icon-button,
  .top-actions .soft-button {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
  }

  .pulse-copy h2 {
    font-size: clamp(2.25rem, 12vw, 2.85rem) !important;
  }

  .timeline-item {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .timeline-item .memory-thumb {
    width: 100% !important;
    aspect-ratio: 16 / 10 !important;
  }

  .message {
    max-width: 92% !important;
  }
}

/* Mobile vertical flow repair */
@media (max-width: 840px) {
  html,
  body {
    height: auto !important;
    min-height: 100% !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .app-shell,
  .workspace,
  .view,
  .home-grid,
  .split-layout,
  .tool-panel,
  .timeline,
  .letter-grid,
  .plan-grid,
  .widget,
  .pulse-widget {
    overflow-x: clip !important;
    overflow-y: visible !important;
  }

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

  .home-grid,
  .split-layout {
    align-content: start !important;
  }

  #home-activity-list {
    max-height: none !important;
    overflow: visible !important;
  }

  .topbar {
    margin-bottom: 8px !important;
    padding-bottom: 8px !important;
  }

  .widget,
  .pulse-widget,
  .tool-panel {
    padding: 14px !important;
  }

  .tool-panel {
    gap: 11px !important;
  }

  .tool-panel textarea {
    min-height: 96px !important;
  }

  .tool-panel textarea[name="note"],
  .tool-panel textarea[name="checklist"] {
    min-height: 74px !important;
  }

  .chat-layout {
    overflow: visible !important;
  }
}

/* Mobile density redesign */
@media (max-width: 840px) {
  body {
    background:
      linear-gradient(130deg, rgba(220, 239, 234, 0.5), transparent 34%),
      linear-gradient(245deg, rgba(244, 220, 224, 0.48), transparent 40%),
      #fbf6ef !important;
  }

  .app-shell {
    padding: calc(8px + env(safe-area-inset-top)) 10px calc(132px + env(safe-area-inset-bottom)) !important;
  }

  .topbar {
    align-items: center !important;
    margin-bottom: 8px !important;
    padding: 4px 0 8px !important;
  }

  .topbar .eyebrow {
    display: none !important;
  }

  .topbar h1 {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
    font-size: clamp(1.42rem, 6vw, 1.82rem) !important;
    font-weight: 900 !important;
    line-height: 1.05 !important;
  }

  .top-actions {
    gap: 6px !important;
  }

  .top-actions .icon-button,
  .top-actions .soft-button {
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    border-radius: 12px !important;
  }

  .home-grid {
    gap: 10px !important;
  }

  .widget,
  .pulse-widget,
  .tool-panel,
  .timeline-item,
  .letter-card,
  .plan-card,
  .chat-layout {
    border-radius: 14px !important;
    box-shadow:
      0 12px 28px rgba(54, 41, 32, 0.07),
      inset 0 1px 0 rgba(255, 255, 255, 0.72) !important;
  }

  .widget,
  .pulse-widget {
    padding: 13px !important;
  }

  .widget .eyebrow,
  .tool-panel .eyebrow {
    font-size: 0.68rem !important;
    line-height: 1 !important;
  }

  .widget h2,
  .tool-panel h2 {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
    font-size: 1.08rem !important;
    font-weight: 900 !important;
    line-height: 1.12 !important;
  }

  .pulse-widget {
    grid-template-columns: minmax(0, 1fr) 112px !important;
    gap: 8px !important;
    align-items: center !important;
    min-height: 152px !important;
    background:
      radial-gradient(circle at 86% 44%, rgba(255, 226, 224, 0.72), transparent 38%),
      linear-gradient(120deg, rgba(255, 253, 248, 0.96), rgba(255, 247, 240, 0.86)) !important;
  }

  .pulse-widget::after,
  .pulse-path,
  .pulse-person small,
  .pulse-send-label {
    display: none !important;
  }

  .pulse-copy {
    max-width: none !important;
  }

  .pulse-copy h2 {
    max-width: 100% !important;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
    font-size: 1.34rem !important;
    font-weight: 900 !important;
    line-height: 1.08 !important;
  }

  .pulse-copy > p:not(.eyebrow) {
    margin-top: 5px !important;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
    font-size: 0.83rem !important;
    line-height: 1.32 !important;
  }

  .pulse-meta {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    margin-top: 9px !important;
  }

  .pulse-meta span {
    min-height: 26px !important;
    padding: 0 9px !important;
    font-size: 0.76rem !important;
  }

  .pulse-visual {
    min-height: 112px !important;
    max-height: 112px !important;
    overflow: visible !important;
  }

  .pulse-person {
    top: auto !important;
    bottom: 0 !important;
  }

  .pulse-person .avatar {
    width: 34px !important;
    height: 34px !important;
  }

  .pulse-person-me {
    left: 0 !important;
  }

  .pulse-person-partner {
    right: 0 !important;
  }

  .heart-button {
    width: 78px !important;
    height: 78px !important;
    box-shadow:
      0 14px 28px rgba(207, 93, 85, 0.24),
      0 0 0 9px rgba(255, 235, 229, 0.82),
      inset 0 -8px 18px rgba(91, 32, 38, 0.13) !important;
  }

  .heart-button .icon {
    width: 32px !important;
    height: 32px !important;
  }

  .mood-widget,
  .safe-widget,
  .question-widget,
  .countdown-widget,
  .memory-widget,
  .activity-widget,
  .chat-preview-widget {
    min-height: 0 !important;
  }

  .widget-heading {
    margin-bottom: 10px !important;
  }

  .mood-widget .widget-heading {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 8px !important;
  }

  .mood-options {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  .mood-chip {
    min-height: 44px !important;
    padding: 6px !important;
    font-size: 0.74rem !important;
    line-height: 1.05 !important;
  }

  .signal-detail,
  .rhythm-line,
  .question-text,
  .safe-widget p,
  .countdown-widget p {
    font-size: 0.84rem !important;
    line-height: 1.32 !important;
  }

  .countdown-number {
    margin-top: 6px !important;
    font-size: 2.35rem !important;
    line-height: 1 !important;
  }

  .activity-widget {
    gap: 8px !important;
  }

  #home-activity-list .mini-activity-item {
    grid-template-columns: 30px minmax(0, 1fr) !important;
    padding: 9px !important;
  }

  .activity-feed-title {
    display: grid !important;
    gap: 2px !important;
  }

  .activity-row {
    padding: 6px 0 !important;
    font-size: 0.82rem !important;
  }

  .activity-row strong {
    font-size: 0.82rem !important;
  }

  .tool-panel {
    gap: 10px !important;
    padding: 14px !important;
  }

  .form-heading {
    gap: 3px !important;
  }

  .tool-panel label {
    gap: 5px !important;
    font-size: 0.78rem !important;
  }

  .tool-panel input,
  .tool-panel select,
  .tool-panel textarea {
    min-height: 42px !important;
    padding: 9px 11px !important;
    font-size: 0.95rem !important;
  }

  .tool-panel textarea {
    min-height: 82px !important;
  }

  .tool-panel textarea[name="caption"] {
    min-height: 84px !important;
  }

  .tool-panel textarea[name="body"] {
    min-height: 118px !important;
  }

  .primary-button,
  .soft-button {
    min-height: 44px !important;
    border-radius: 12px !important;
  }

  .letter-grid,
  .plan-grid,
  .timeline {
    gap: 10px !important;
  }

  .timeline-item,
  .letter-card,
  .plan-card {
    min-height: 0 !important;
    padding: 12px !important;
  }

  .sidebar {
    height: calc(68px + env(safe-area-inset-bottom)) !important;
    padding-top: 6px !important;
    border-radius: 16px 16px 0 0 !important;
  }

  .main-nav {
    height: 54px !important;
  }

  .nav-item {
    height: 54px !important;
    min-height: 54px !important;
    border-radius: 13px !important;
  }

  .nav-item .icon {
    width: 22px !important;
    height: 22px !important;
  }
}

@media (max-width: 380px) {
  .mood-options {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .pulse-widget {
    grid-template-columns: minmax(0, 1fr) 96px !important;
  }

  .heart-button {
    width: 70px !important;
    height: 70px !important;
  }
}

/* Emergency mobile scroll unlock */
@media (max-width: 840px) {
  html {
    height: auto !important;
    min-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: scroll !important;
  }

  body {
    position: static !important;
    height: auto !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    overflow-x: hidden !important;
    overflow-y: scroll !important;
    touch-action: pan-y !important;
    overscroll-behavior-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  body:not(.is-locked) .app-shell {
    position: relative !important;
    height: auto !important;
    min-height: calc(100dvh + 1px) !important;
    max-height: none !important;
    overflow: visible !important;
    contain: none !important;
    padding-bottom: calc(170px + env(safe-area-inset-bottom)) !important;
  }

  body:not(.is-locked) .workspace,
  body:not(.is-locked) .view,
  body:not(.is-locked) .home-grid,
  body:not(.is-locked) .split-layout,
  body:not(.is-locked) .tool-panel,
  body:not(.is-locked) .timeline,
  body:not(.is-locked) .letter-grid,
  body:not(.is-locked) .plan-grid,
  body:not(.is-locked) .widget,
  body:not(.is-locked) .pulse-widget,
  body:not(.is-locked) .activity-widget,
  body:not(.is-locked) .chat-preview-widget {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    contain: none !important;
  }

  body:not(.is-locked) .chat-layout {
    height: auto !important;
    min-height: calc(100dvh - 152px) !important;
    max-height: none !important;
    overflow: visible !important;
  }

  body:not(.is-locked) .message-list {
    min-height: 360px !important;
    max-height: calc(100dvh - 320px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }
}

/* Mobile home simplification */
.mobile-wordmark,
.app-menu-button,
.app-menu-label {
  display: none;
}

.top-actions > #activity-button,
#home-view .activity-widget,
#home-view .chat-preview-widget {
  display: none !important;
}

@media (max-width: 840px) {
  .topbar {
    position: sticky !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    min-height: 52px !important;
    padding: 5px 0 7px !important;
  }

  .topbar > div:first-child {
    display: none !important;
  }

  .mobile-wordmark {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    color: var(--text);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.34rem;
    line-height: 1;
  }

  .mobile-wordmark .brand-mark {
    width: 30px !important;
    height: 30px !important;
    border-radius: 9px !important;
  }

  .top-actions {
    position: absolute !important;
    top: 5px !important;
    right: 0 !important;
    z-index: 80 !important;
    display: block !important;
  }

  .app-menu-button {
    display: grid !important;
    place-items: center !important;
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
  }

  .top-actions > #activity-button {
    display: none !important;
  }

  .top-actions > #install-button,
  .top-actions > #privacy-button,
  .top-actions > .top-logout {
    display: none !important;
  }

  .top-actions.menu-open > #install-button,
  .top-actions.menu-open > #privacy-button,
  .top-actions.menu-open > .top-logout {
    position: absolute !important;
    right: 0 !important;
    z-index: 90 !important;
    display: flex !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    width: 184px !important;
    min-width: 184px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 14px !important;
    border: 1px solid rgba(55, 42, 32, 0.1) !important;
    border-radius: 12px !important;
    background: rgba(255, 253, 248, 0.98) !important;
    color: var(--text) !important;
    box-shadow: 0 14px 34px rgba(54, 41, 32, 0.16) !important;
    font-size: 0.88rem !important;
    font-weight: 800 !important;
  }

  .top-actions.menu-open > #privacy-button {
    top: 47px !important;
  }

  .top-actions.menu-open > #install-button {
    top: 95px !important;
  }

  .top-actions.menu-open > .top-logout {
    top: 143px !important;
  }

  .top-actions.menu-open .app-menu-label,
  .top-actions.menu-open .logout-label {
    display: inline !important;
  }

  #home-view .pulse-widget {
    display: block !important;
    min-height: 168px !important;
    padding: 10px 12px !important;
    background:
      radial-gradient(circle at 50% 50%, rgba(255, 226, 224, 0.76), transparent 43%),
      linear-gradient(120deg, rgba(255, 253, 248, 0.96), rgba(255, 247, 240, 0.88)) !important;
  }

  #home-view .pulse-copy {
    display: none !important;
  }

  #home-view .pulse-visual {
    width: 100% !important;
    min-height: 148px !important;
    max-height: 148px !important;
  }

  #home-view .pulse-path,
  #home-view .pulse-send-label {
    display: none !important;
  }

  #home-view .heart-button {
    width: 102px !important;
    height: 102px !important;
    box-shadow:
      0 18px 34px rgba(207, 93, 85, 0.25),
      0 0 0 10px rgba(255, 235, 229, 0.76),
      inset 0 -8px 18px rgba(91, 32, 38, 0.13) !important;
  }

  #home-view .heart-button .icon {
    width: 40px !important;
    height: 40px !important;
  }

  #home-view .pulse-person {
    top: 50% !important;
    bottom: auto !important;
    display: grid !important;
    justify-items: center !important;
    gap: 4px !important;
    transform: translateY(-50%) !important;
  }

  #home-view .pulse-person-me {
    left: 5% !important;
  }

  #home-view .pulse-person-partner {
    right: 5% !important;
  }

  #home-view .pulse-person .avatar {
    width: 46px !important;
    height: 46px !important;
  }

  #home-view .pulse-person small {
    display: block !important;
    max-width: 82px !important;
    color: rgba(54, 41, 32, 0.68) !important;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif !important;
    font-size: 0.68rem !important;
    font-weight: 750 !important;
    text-align: center !important;
  }

  #home-view .mood-widget {
    padding: 12px !important;
  }

  #home-view .mood-widget .widget-heading {
    grid-template-columns: minmax(0, 1fr) auto !important;
    margin-bottom: 8px !important;
  }

  #home-view .mood-widget h2 {
    font-size: 1rem !important;
  }

  #home-view .mood-widget .mini-badge {
    min-height: 28px !important;
    padding: 0 9px !important;
    font-size: 0.7rem !important;
  }

  #home-view .mood-options {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  #home-view .mood-chip {
    display: grid !important;
    place-items: center !important;
    min-height: 52px !important;
    padding: 4px !important;
  }

  #home-view .mood-emoji {
    display: block !important;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
    font-size: 1.55rem !important;
    line-height: 1 !important;
  }

  #home-view .mood-text,
  #home-view .signal-detail {
    display: none !important;
  }

  #home-view .activity-widget,
  #home-view .chat-preview-widget {
    display: none !important;
  }
}

/* Personal spaces: pulse, compact chat and collection views */
.pulse-visual {
  isolation: isolate;
}

.pulse-path {
  display: block;
  inset: 50% auto auto 50%;
  z-index: 0;
  width: min(72%, 410px);
  height: 72%;
  border: 2px solid rgba(207, 93, 85, 0.24);
  border-right-color: rgba(36, 115, 107, 0.32);
  border-bottom-color: rgba(140, 102, 203, 0.28);
  border-radius: 50%;
  opacity: 0.8;
  transform: translate(-50%, -50%) rotate(-8deg);
}

.pulse-path::before,
.pulse-path::after {
  display: none;
}

.pulse-spark {
  position: absolute;
  z-index: 1;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: #e8ae70;
  box-shadow: 0 0 0 5px rgba(232, 174, 112, 0.09);
  rotate: 45deg;
  animation: pulse-twinkle 2.8s ease-in-out infinite;
}

.pulse-spark-one {
  top: 21%;
  left: 25%;
}

.pulse-spark-two {
  top: 24%;
  right: 25%;
  width: 6px;
  height: 6px;
  background: #b28bd9;
  animation-delay: 700ms;
}

.pulse-spark-three {
  right: 18%;
  bottom: 20%;
  width: 5px;
  height: 5px;
  background: #6daaa3;
  animation-delay: 1.4s;
}

.pulse-float-heart {
  position: absolute;
  z-index: 1;
  color: rgba(207, 93, 85, 0.62);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.8rem;
  line-height: 1;
  animation: pulse-heart-float 3.4s ease-in-out infinite;
}

.pulse-float-heart-one {
  top: 31%;
  left: 37%;
}

.pulse-float-heart-two {
  right: 36%;
  bottom: 27%;
  color: rgba(140, 102, 203, 0.5);
  animation-delay: 1.1s;
}

@keyframes pulse-twinkle {
  0%,
  100% {
    opacity: 0.36;
    transform: scale(0.74);
  }
  50% {
    opacity: 1;
    transform: scale(1.12);
  }
}

@keyframes pulse-heart-float {
  0%,
  100% {
    opacity: 0.42;
    transform: translateY(2px) scale(0.92);
  }
  50% {
    opacity: 0.9;
    transform: translateY(-5px) scale(1.08);
  }
}

.collection-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
  padding: 4px 2px;
}

.collection-header > div {
  display: grid;
  gap: 3px;
}

.collection-header h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 500;
}

.collection-add-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  min-width: 54px;
  height: 54px;
  border: 1px solid rgba(207, 93, 85, 0.24);
  border-radius: 50%;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(255, 229, 224, 0.9));
  color: var(--rose);
  box-shadow:
    0 14px 30px rgba(207, 93, 85, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.collection-add-button:hover {
  transform: translateY(-2px) rotate(4deg);
  box-shadow:
    0 18px 34px rgba(207, 93, 85, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.collection-add-button .icon {
  width: 24px;
  height: 24px;
}

.collection-layout {
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
}

.item-composer {
  position: relative;
  top: auto;
  width: min(100%, 680px);
  justify-self: center;
  margin-bottom: 4px;
  animation: composer-reveal 220ms ease both;
}

.item-composer[hidden] {
  display: none !important;
}

@keyframes composer-reveal {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Compact contact header */
.chat-status-bar {
  min-height: 52px;
  padding: 6px 8px;
  border-color: rgba(55, 42, 32, 0.08);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.72);
}

.chat-contact-avatar {
  position: relative;
  flex: 0 0 auto;
}

.chat-contact-avatar > .avatar {
  width: 40px;
  height: 40px;
  font-size: 0.78rem;
}

.chat-contact-avatar .presence-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border: 2px solid #fffaf5;
  box-shadow: none;
}

.chat-contact-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.chat-contact-copy h2 {
  overflow: hidden;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.96rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-contact-copy #chat-presence-detail {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: left;
}

.message {
  gap: 4px;
  max-width: min(520px, 76%);
  padding: 8px 11px;
  border-radius: 18px 18px 18px 6px;
  box-shadow: 0 6px 14px rgba(58, 45, 38, 0.06);
}

.message.mine {
  border-radius: 18px 18px 6px 18px;
}

.message-meta {
  gap: 8px;
  font-size: 0.67rem;
}

.message-body {
  font-size: 0.95rem;
  line-height: 1.34;
}

.message-reaction-badge {
  position: absolute;
  bottom: -14px;
  z-index: 5;
  width: 26px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 2px solid #fffaf5;
  background: #fffaf5;
}

.message.mine .message-reaction-badge {
  right: 8px;
}

.message.theirs .message-reaction-badge {
  left: 8px;
}

.message:has(.message-reaction-badge) {
  margin-bottom: 14px;
}

.message-seen {
  position: absolute;
  top: calc(100% + 3px);
  right: 38px;
  margin-top: 0;
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1;
  opacity: 0.72;
}

.message:has(.message-seen) {
  margin-bottom: 14px;
}

/* Illustrated envelopes */
.letter-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  min-height: 0;
}

.letter-card.envelope-card {
  display: grid;
  gap: 12px;
  min-height: 0;
  padding: 14px;
  overflow: visible;
  border-color: rgba(207, 93, 85, 0.13);
  background:
    linear-gradient(160deg, rgba(255, 253, 248, 0.84), rgba(255, 239, 232, 0.72));
}

.letter-card.envelope-card::before {
  display: none;
}

.letter-envelope-scene {
  display: block;
  width: 100%;
  height: 218px;
  padding: 0;
  border: 0;
  background: transparent;
  perspective: 900px;
  transition: height 440ms ease;
}

.letter-card.open .letter-envelope-scene {
  height: 338px;
}

.letter-envelope {
  position: relative;
  display: block;
  width: min(100%, 340px);
  height: 188px;
  margin: 24px auto 0;
  filter: drop-shadow(0 18px 22px rgba(92, 53, 45, 0.15));
}

.letter-envelope-back {
  position: absolute;
  inset: 22px 0 0;
  z-index: 1;
  border: 1px solid rgba(174, 106, 92, 0.2);
  border-radius: 14px;
  background: linear-gradient(150deg, #f7c9bc, #efaa9d);
}

.letter-paper {
  position: absolute;
  top: 34px;
  right: 8%;
  left: 8%;
  z-index: 2;
  display: grid;
  gap: 6px;
  height: 132px;
  padding: 18px 18px 14px;
  overflow: hidden;
  border: 1px solid rgba(125, 91, 73, 0.14);
  border-radius: 10px 10px 5px 5px;
  background:
    repeating-linear-gradient(180deg, transparent 0 25px, rgba(157, 115, 95, 0.08) 25px 26px),
    #fffdf8;
  color: var(--text);
  text-align: left;
  transform-origin: center bottom;
  transition: transform 520ms cubic-bezier(0.2, 0.78, 0.22, 1), height 420ms ease;
}

.letter-paper-kicker {
  color: var(--rose);
  font-size: 0.65rem;
  font-weight: 900;
  text-transform: uppercase;
}

.letter-paper strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.08rem;
}

.letter-paper-body {
  display: block;
  max-height: 148px;
  overflow-y: auto;
  color: rgba(54, 41, 32, 0.76);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.94rem;
  line-height: 1.52;
  white-space: pre-wrap;
}

.letter-envelope-front {
  position: absolute;
  inset: 22px 0 0;
  z-index: 4;
  border-radius: 14px;
  background:
    linear-gradient(32deg, #f2b4a7 49.5%, transparent 50%) left / 50.5% 100% no-repeat,
    linear-gradient(-32deg, #efaa9d 49.5%, transparent 50%) right / 50.5% 100% no-repeat,
    linear-gradient(180deg, transparent 48%, #f7c9bc 49%);
  pointer-events: none;
}

.letter-envelope-flap {
  position: absolute;
  inset: 22px 0 auto;
  z-index: 5;
  height: 55%;
  clip-path: polygon(0 0, 100% 0, 50% 88%);
  border-radius: 14px 14px 0 0;
  background: linear-gradient(160deg, #ffd8cd, #efa99c);
  transform-origin: top center;
  transition: transform 480ms cubic-bezier(0.22, 0.72, 0.2, 1), z-index 0s linear 230ms;
}

.letter-envelope-seal {
  position: absolute;
  top: 91px;
  left: 50%;
  z-index: 6;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  background: linear-gradient(145deg, #db6f78, #b84f62);
  color: #fff;
  box-shadow: 0 8px 18px rgba(145, 51, 66, 0.24);
  transform: translateX(-50%);
  transition: opacity 180ms ease, transform 260ms ease;
}

.letter-envelope-seal .icon {
  width: 18px;
  height: 18px;
}

.letter-card.open .letter-envelope-flap {
  z-index: 0;
  transform: rotateX(180deg);
}

.letter-card.open .letter-paper {
  z-index: 5;
  height: 260px;
  transform: translateY(-20px);
}

.letter-card.open .letter-envelope-seal {
  opacity: 0;
  transform: translateX(-50%) scale(0.72);
}

.letter-card-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.letter-card-caption > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.letter-card-caption strong {
  overflow: hidden;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.letter-card-caption span {
  color: var(--muted);
  font-size: 0.75rem;
}

.letter-card-caption .letter-actions {
  display: flex;
  grid-template-columns: none;
  flex: 0 0 auto;
}

/* A warm shared calendar */
.plan-calendar {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border: 1px solid rgba(36, 115, 107, 0.14);
  border-radius: 22px;
  background:
    linear-gradient(150deg, rgba(255, 253, 248, 0.96), rgba(232, 245, 241, 0.8) 58%, rgba(255, 232, 228, 0.76));
  box-shadow:
    0 20px 44px rgba(54, 41, 32, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.plan-calendar::after {
  position: absolute;
  right: 18px;
  bottom: 12px;
  color: rgba(207, 93, 85, 0.14);
  content: "♥";
  font-family: Georgia, "Times New Roman", serif;
  font-size: 4rem;
  line-height: 1;
  pointer-events: none;
}

.calendar-toolbar {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.calendar-toolbar > div {
  display: grid;
  gap: 2px;
  text-align: center;
}

.calendar-toolbar span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: uppercase;
}

.calendar-toolbar strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  font-weight: 500;
}

.calendar-nav-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(36, 115, 107, 0.14);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.66);
  color: var(--teal);
}

.calendar-nav-button.previous .icon {
  transform: rotate(180deg);
}

.calendar-weekdays,
.calendar-days {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
}

.calendar-weekdays {
  margin-bottom: 7px;
}

.calendar-weekdays span {
  color: rgba(54, 41, 32, 0.5);
  font-size: 0.68rem;
  font-weight: 900;
  text-align: center;
}

.calendar-day {
  position: relative;
  display: grid;
  place-items: center;
  gap: 3px;
  aspect-ratio: 1;
  min-width: 0;
  padding: 4px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.42);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 780;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.calendar-day:not(.calendar-day-empty):hover {
  transform: translateY(-1px);
  border-color: rgba(36, 115, 107, 0.18);
}

.calendar-day.today {
  border-color: rgba(232, 174, 112, 0.62);
}

.calendar-day.selected {
  border-color: rgba(207, 93, 85, 0.28);
  background: linear-gradient(145deg, rgba(255, 225, 218, 0.92), rgba(255, 255, 255, 0.76));
  color: #a94755;
  box-shadow: 0 9px 18px rgba(207, 93, 85, 0.12);
}

.calendar-day-empty {
  visibility: hidden;
}

.calendar-plan-dots {
  display: flex;
  gap: 2px;
  height: 4px;
}

.calendar-plan-dots i {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--rose);
}

.calendar-plan-dots i:nth-child(2) {
  background: var(--teal);
}

.calendar-plan-dots i:nth-child(3) {
  background: #b28bd9;
}

.calendar-agenda {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
}

.calendar-agenda-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 4px 2px 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.calendar-agenda-heading strong {
  color: var(--teal);
}

.calendar-empty {
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 28px 18px;
  border: 1px dashed rgba(36, 115, 107, 0.2);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.58);
  color: var(--muted);
  text-align: center;
}

.calendar-empty .icon {
  width: 26px;
  height: 26px;
  color: var(--rose);
}

.calendar-empty strong {
  color: var(--text);
}

.calendar-plan-card {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  min-height: 0;
  padding: 14px;
  border-color: rgba(36, 115, 107, 0.12);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.84), rgba(255, 247, 240, 0.8));
}

.calendar-plan-card::before {
  display: none;
}

.calendar-plan-date {
  display: grid;
  place-items: center;
  width: 62px;
  height: 68px;
  border-radius: 16px;
  background: linear-gradient(145deg, #d9ece8, #f7e7dd);
  color: var(--teal);
}

.calendar-plan-date span {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.85rem;
  line-height: 0.9;
}

.calendar-plan-date small {
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.calendar-plan-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.calendar-plan-type {
  color: var(--rose);
  font-size: 0.67rem;
  font-weight: 900;
  text-transform: uppercase;
}

.calendar-plan-copy h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.22rem;
  font-weight: 600;
}

.calendar-plan-copy p,
.calendar-plan-note {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.38;
}

@media (max-width: 840px) {
  #home-view .countdown-widget,
  #home-view .memory-widget {
    display: none !important;
  }

  #home-view .pulse-widget {
    min-height: 192px !important;
    padding: 8px 10px !important;
    border-color: rgba(207, 93, 85, 0.14) !important;
    background:
      linear-gradient(150deg, rgba(255, 253, 248, 0.98), rgba(255, 231, 226, 0.72) 54%, rgba(221, 240, 236, 0.72)) !important;
  }

  #home-view .pulse-widget::before {
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 18px;
    content: "";
    pointer-events: none;
  }

  #home-view .pulse-visual {
    min-height: 174px !important;
    max-height: 174px !important;
  }

  #home-view .pulse-path {
    display: block !important;
    width: 68% !important;
    height: 60% !important;
  }

  #home-view .heart-button {
    width: 98px !important;
    height: 98px !important;
    background:
      linear-gradient(145deg, rgba(244, 135, 126, 0.96), rgba(190, 63, 85, 0.98)) !important;
    box-shadow:
      0 18px 34px rgba(190, 63, 85, 0.24),
      0 0 0 8px rgba(255, 255, 255, 0.55),
      0 0 0 16px rgba(255, 219, 215, 0.48) !important;
  }

  #home-view .pulse-person .avatar {
    width: 50px !important;
    height: 50px !important;
    border: 3px solid rgba(255, 255, 255, 0.82);
    box-shadow: 0 12px 24px rgba(54, 41, 32, 0.14);
  }

  .collection-header {
    margin-bottom: 10px;
    padding: 3px 2px;
  }

  .collection-header h2 {
    font-size: 1.65rem;
  }

  .collection-add-button {
    width: 46px;
    min-width: 46px;
    height: 46px;
  }

  .item-composer {
    margin-bottom: 2px;
  }

  #chat-view.active {
    height: calc(100dvh - 80px) !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  #chat-view .chat-layout {
    grid-template-rows: 50px minmax(0, 1fr) auto auto auto !important;
    gap: 6px !important;
    height: calc(100dvh - 138px - env(safe-area-inset-bottom)) !important;
    min-height: 0 !important;
    padding: 7px !important;
    overflow: hidden !important;
  }

  #chat-view .chat-status-bar {
    min-height: 50px !important;
    padding: 5px 7px !important;
  }

  #chat-view .message-list {
    min-height: 0 !important;
    max-height: none !important;
    padding: 10px 7px 20px !important;
    border-radius: 16px !important;
    overflow-y: auto !important;
  }

  #chat-view .message {
    gap: 3px !important;
    max-width: 78% !important;
    padding: 7px 10px !important;
  }

  #chat-view .message.mine .message-author {
    display: none !important;
  }

  #chat-view .message.mine .message-meta {
    justify-content: flex-end !important;
  }

  #chat-view .message-meta {
    font-size: 0.62rem !important;
  }

  #chat-view .message-body {
    font-size: 0.92rem !important;
  }

  #chat-view .composer {
    grid-template-columns: 40px minmax(0, 1fr) 42px !important;
    gap: 6px !important;
    padding: 6px !important;
    border-radius: 15px !important;
  }

  #chat-view .composer input {
    min-height: 40px !important;
    padding: 0 11px !important;
  }

  #chat-view #chat-image-button,
  #chat-view #chat-submit-button {
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
  }

  .letter-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
  }

  .letter-card.envelope-card {
    padding: 10px !important;
  }

  .letter-envelope-scene {
    height: 206px;
  }

  .letter-card.open .letter-envelope-scene {
    height: 328px;
  }

  .letter-envelope {
    height: 178px;
  }

  .plan-calendar {
    padding: 13px 10px;
    border-radius: 18px;
  }

  .calendar-toolbar {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    gap: 8px;
    margin-bottom: 12px;
  }

  .calendar-toolbar strong {
    font-size: 1.22rem;
  }

  .calendar-nav-button {
    width: 38px;
    height: 38px;
  }

  .calendar-weekdays,
  .calendar-days {
    gap: 4px;
  }

  .calendar-day {
    border-radius: 11px;
    font-size: 0.78rem;
  }

  .calendar-plan-card {
    grid-template-columns: 52px minmax(0, 1fr) auto !important;
    gap: 10px !important;
    padding: 11px !important;
  }

  .calendar-plan-date {
    width: 52px;
    height: 58px;
    border-radius: 14px;
  }

  .calendar-plan-date span {
    font-size: 1.55rem;
  }

  .calendar-plan-copy h2 {
    font-size: 1.08rem;
  }

  .calendar-plan-card .plan-actions {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pulse-spark,
  .pulse-float-heart,
  .letter-envelope-flap,
  .letter-paper,
  .letter-envelope-seal {
    animation: none !important;
    transition-duration: 1ms !important;
  }
}

/* June 11 polish: home priority, settings scrolling, chat presence and letter reading */
#home-view .safe-widget {
  order: 100;
}

#settings-modal {
  z-index: 1600 !important;
  place-items: start center !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)) !important;
}

#settings-modal .settings-modal-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(760px, 100%) !important;
  max-height: calc(100dvh - max(24px, env(safe-area-inset-top)) - max(24px, env(safe-area-inset-bottom))) !important;
  overflow: hidden !important;
}

#settings-modal .modal-heading {
  position: relative;
  z-index: 2;
}

#settings-modal .settings-form {
  min-height: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  padding: 2px 5px calc(28px + env(safe-area-inset-bottom)) 1px;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

#chat-view .chat-status-bar,
#chat-view .chat-status-main {
  overflow: visible !important;
}

#chat-view .chat-status-main {
  min-height: 40px;
  align-items: center !important;
}

#chat-view .chat-contact-avatar {
  display: grid !important;
  flex: 0 0 40px !important;
  place-items: center;
  width: 40px !important;
  height: 40px !important;
  align-self: center;
}

#chat-view .chat-contact-avatar > .avatar {
  width: 40px !important;
  min-width: 40px !important;
  height: 40px !important;
  min-height: 40px !important;
  margin: 0 !important;
  font-size: 0.78rem !important;
}

#chat-view .chat-contact-avatar .presence-dot {
  right: -1px !important;
  bottom: -1px !important;
}

#chat-view #chat-presence-detail {
  display: none !important;
}

#chat-view .presence-dot.typing {
  background: var(--teal) !important;
}

.letter-paper strong,
.letter-paper-body {
  font-family: "Segoe Print", "Bradley Hand ITC", "Apple Chancery", "Lucida Handwriting", cursive;
  letter-spacing: 0;
}

.letter-paper strong {
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.35;
}

.letter-paper-body {
  scrollbar-color: rgba(190, 97, 105, 0.34) transparent;
  scrollbar-width: thin;
}

.letter-card.open .letter-envelope-scene {
  height: clamp(390px, 58dvh, 540px);
  overflow: hidden;
  border: 1px solid rgba(190, 97, 105, 0.14);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.46);
  box-shadow: inset 0 0 36px rgba(211, 154, 132, 0.08);
  touch-action: pan-y;
}

.letter-card.open .letter-envelope {
  width: 100%;
  height: 100%;
  margin: 0;
  filter: none;
}

.letter-card.open .letter-envelope-back,
.letter-card.open .letter-envelope-front,
.letter-card.open .letter-envelope-flap,
.letter-card.open .letter-envelope-seal {
  opacity: 0;
  pointer-events: none;
}

.letter-card.open .letter-paper {
  inset: 0 !important;
  z-index: 7;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: auto;
  height: auto !important;
  max-height: none;
  padding: clamp(22px, 5vw, 42px) clamp(18px, 6vw, 48px) clamp(20px, 5vw, 38px);
  overflow: hidden;
  border: 0;
  border-radius: 15px;
  background:
    linear-gradient(90deg, transparent 0 8%, rgba(207, 93, 85, 0.09) 8% calc(8% + 1px), transparent calc(8% + 1px)),
    repeating-linear-gradient(180deg, transparent 0 31px, rgba(117, 91, 75, 0.085) 31px 32px),
    linear-gradient(145deg, #fffdf8, #fff8ef);
  box-shadow: inset 0 0 52px rgba(171, 119, 92, 0.08);
  transform: none !important;
}

.letter-card.open .letter-paper-kicker {
  padding-left: 4%;
}

.letter-card.open .letter-paper strong {
  padding: 4px 4% 8px;
  color: #9e4657;
  font-size: clamp(1.18rem, 4vw, 1.55rem);
}

.letter-card.open .letter-paper-body {
  min-height: 0;
  max-height: none;
  padding: 7px 5% 28px;
  overflow-y: auto;
  color: rgba(54, 41, 32, 0.84);
  font-size: clamp(0.96rem, 3.5vw, 1.12rem);
  line-height: 1.9;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.letter-card.open .letter-card-caption {
  justify-content: flex-end;
}

.letter-card.open .letter-card-caption > div:first-child {
  display: none;
}

@media (max-width: 840px) {
  #settings-modal {
    padding: max(7px, env(safe-area-inset-top)) 7px max(7px, env(safe-area-inset-bottom)) !important;
  }

  #settings-modal .settings-modal-card {
    max-height: calc(100dvh - max(14px, env(safe-area-inset-top)) - max(14px, env(safe-area-inset-bottom))) !important;
    padding: 12px !important;
    border-radius: 18px !important;
  }

  #settings-modal .settings-form {
    padding-bottom: calc(34px + env(safe-area-inset-bottom));
  }

  #chat-view .chat-status-bar {
    min-height: 50px !important;
    padding: 5px 8px !important;
  }

  .letter-card.open .letter-envelope-scene {
    height: min(62dvh, 500px) !important;
    min-height: 360px;
  }

  .letter-card.open .letter-paper {
    padding: 24px 14px 20px;
  }

  .letter-card.open .letter-paper-kicker,
  .letter-card.open .letter-paper strong {
    padding-right: 8%;
    padding-left: 8%;
  }

  .letter-card.open .letter-paper-body {
    padding-right: 9%;
    padding-left: 9%;
  }
}

/* Chat dock and voice messages */
.chat-layout {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.chat-composer-dock {
  position: relative;
  z-index: 12;
  display: grid;
  gap: 7px;
  min-width: 0;
}

.chat-composer-dock > [hidden],
.chat-emoji-picker[hidden],
.chat-recording-bar[hidden] {
  display: none !important;
}

#chat-view .composer {
  position: relative;
  grid-template-columns: 40px 40px minmax(0, 1fr) 44px;
  gap: 6px;
  align-items: center;
  padding: 7px;
  border-color: rgba(78, 61, 50, 0.14);
  border-radius: 18px;
  background: rgba(255, 252, 247, 0.94);
  box-shadow: 0 12px 28px rgba(63, 48, 39, 0.1);
}

#chat-view .composer .icon-button,
#chat-view .composer .send-button {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  border-radius: 13px;
}

#chat-view .composer .icon-button {
  border: 0;
  background: transparent;
  color: rgba(72, 62, 55, 0.72);
}

#chat-view .composer .icon-button:hover,
#chat-view .composer .icon-button[aria-expanded="true"] {
  background: rgba(218, 237, 232, 0.72);
  color: var(--teal);
}

#chat-view .composer input {
  min-height: 40px;
  padding: 0 12px;
  border-color: rgba(91, 73, 61, 0.13);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.76);
}

#chat-submit-button {
  color: #fff;
  transition: transform 150ms ease, background 180ms ease, box-shadow 180ms ease;
}

#chat-submit-button.voice-mode {
  background: linear-gradient(145deg, #347f77, #185e58);
  box-shadow: 0 8px 18px rgba(31, 113, 105, 0.2);
}

#chat-submit-button.send-mode {
  background: linear-gradient(145deg, #d96e78, #b74c60);
  box-shadow: 0 8px 18px rgba(183, 76, 96, 0.22);
}

#chat-submit-button.recording-mode {
  background: linear-gradient(145deg, #e57c79, #bd4356);
  box-shadow: 0 0 0 6px rgba(199, 92, 107, 0.13), 0 8px 18px rgba(183, 76, 96, 0.2);
  animation: recording-button-pulse 1.2s ease-in-out infinite;
}

#chat-submit-button:active {
  transform: scale(0.94);
}

@keyframes recording-button-pulse {
  50% {
    box-shadow: 0 0 0 10px rgba(199, 92, 107, 0.08), 0 8px 18px rgba(183, 76, 96, 0.2);
  }
}

.chat-emoji-picker {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(8, 36px);
  gap: 4px;
  max-width: min(348px, calc(100vw - 34px));
  padding: 8px;
  border: 1px solid rgba(91, 73, 61, 0.14);
  border-radius: 16px;
  background: rgba(255, 252, 247, 0.98);
  box-shadow: 0 18px 42px rgba(54, 41, 32, 0.16);
  overflow-x: auto;
}

.chat-emoji-picker button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 11px;
  background: transparent;
  font-size: 1.2rem;
}

.chat-emoji-picker button:hover {
  background: var(--rose-soft);
}

.chat-recording-bar {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 38px;
  gap: 10px;
  align-items: center;
  min-height: 52px;
  padding: 7px 8px 7px 13px;
  border: 1px solid rgba(199, 92, 107, 0.2);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255, 241, 238, 0.98), rgba(255, 252, 247, 0.96));
  box-shadow: 0 10px 24px rgba(92, 53, 45, 0.08);
}

.chat-recording-bar > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.chat-recording-bar strong {
  overflow: hidden;
  color: #9f4454;
  font-size: 0.84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-recording-bar span:not(.recording-pulse, .icon) {
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.recording-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rose);
  box-shadow: 0 0 0 6px rgba(199, 92, 107, 0.12);
  animation: recording-dot 1s ease-in-out infinite;
}

@keyframes recording-dot {
  50% {
    opacity: 0.45;
    transform: scale(0.82);
  }
}

.message-voice {
  display: grid;
  grid-template-columns: 38px minmax(108px, 1fr) auto;
  gap: 9px;
  align-items: center;
  width: min(280px, 68vw);
  min-height: 48px;
}

.voice-play-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
}

.message.theirs .voice-play-button {
  background: rgba(31, 113, 105, 0.12);
  color: var(--teal);
}

.voice-play-button .icon {
  width: 17px;
  height: 17px;
}

.voice-waveform {
  position: relative;
  display: grid;
  align-items: center;
  width: 100%;
  height: 36px;
  padding: 0;
  background: transparent;
  color: inherit;
}

.voice-bars {
  display: flex;
  gap: 2px;
  align-items: center;
  width: 100%;
  height: 30px;
  opacity: 0.74;
}

.voice-bars i {
  flex: 1 1 2px;
  height: var(--bar-height);
  min-width: 2px;
  max-width: 4px;
  border-radius: 999px;
  background: currentColor;
}

.voice-progress-track {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

.message.theirs .voice-progress-track {
  background: rgba(31, 113, 105, 0.12);
}

.voice-progress-track > i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: currentColor;
}

.voice-time {
  min-width: 34px;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  opacity: 0.72;
  text-align: right;
}

.message-voice audio {
  display: none;
}

@media (max-width: 840px) {
  body.chat-active {
    height: 100dvh !important;
    min-height: 0 !important;
    overflow: hidden !important;
    overscroll-behavior: none !important;
  }

  body.chat-active .app-shell {
    height: 100dvh !important;
    min-height: 0 !important;
    padding: calc(7px + env(safe-area-inset-top)) 10px calc(76px + env(safe-area-inset-bottom)) !important;
    overflow: hidden !important;
  }

  body.chat-active .workspace {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body.chat-active #chat-view.active {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: hidden !important;
  }

  body.chat-active #chat-view .chat-layout {
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    gap: 6px !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 7px !important;
    overflow: hidden !important;
  }

  body.chat-active #chat-view .message-list {
    min-height: 0 !important;
    max-height: none !important;
    padding: 9px 7px 18px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  body.chat-active #chat-view .chat-composer-dock {
    position: relative !important;
    inset: auto !important;
    flex: none;
    padding: 0 !important;
    background: transparent;
  }

  body.chat-active #chat-view .composer {
    grid-template-columns: 38px 38px minmax(0, 1fr) 42px !important;
    gap: 4px !important;
    padding: 6px !important;
    border-radius: 17px !important;
  }

  body.chat-active #chat-view .composer .icon-button {
    width: 38px !important;
    min-width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
  }

  body.chat-active #chat-view #chat-submit-button {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
  }

  body.chat-active #chat-view .composer input {
    min-height: 40px !important;
    padding: 0 10px !important;
  }

  body.chat-active #chat-view .composer-status {
    min-height: 0;
    padding: 0 4px;
  }

  .chat-emoji-picker {
    grid-template-columns: repeat(8, 34px);
    max-width: calc(100vw - 34px);
  }

  .chat-emoji-picker button {
    width: 34px;
    height: 34px;
  }
}

@media (max-width: 370px) {
  body.chat-active #chat-view .composer {
    grid-template-columns: 36px 36px minmax(0, 1fr) 40px !important;
  }

  body.chat-active #chat-view .composer .icon-button {
    width: 36px !important;
    min-width: 36px !important;
  }
}

/* June 11 intimate spaces: focused chat, keepsake album and private entry */
body.chat-active .topbar {
  display: none !important;
}

#chat-view .composer {
  grid-template-columns: 40px minmax(0, 1fr) 44px !important;
  gap: 7px;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

#chat-view .chat-input-shell {
  position: relative;
  min-width: 0;
}

#chat-view .chat-input-shell #chat-input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 48px 0 15px !important;
  border: 1px solid rgba(91, 73, 61, 0.14);
  border-radius: 16px;
  background: rgba(255, 253, 249, 0.98);
  box-shadow: 0 8px 22px rgba(61, 47, 38, 0.07);
}

#chat-view .chat-input-shell #chat-input:focus {
  border-color: rgba(39, 126, 116, 0.38);
  box-shadow: 0 0 0 3px rgba(70, 145, 136, 0.1), 0 8px 22px rgba(61, 47, 38, 0.07);
}

#chat-view .chat-input-shell #chat-image-button {
  position: absolute;
  top: 50%;
  right: 4px;
  z-index: 2;
  width: 36px !important;
  min-width: 36px !important;
  height: 36px !important;
  min-height: 36px !important;
  border-radius: 12px;
  transform: translateY(-50%);
}

#chat-view #chat-emoji-button {
  align-self: center;
  border: 1px solid rgba(91, 73, 61, 0.11);
  background: rgba(255, 251, 246, 0.9);
  box-shadow: 0 7px 18px rgba(61, 47, 38, 0.06);
}

#chat-view #chat-submit-button {
  align-self: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  border-radius: 15px;
}

/* A small shared draw replaces the utilitarian home-arrival control. */
.playful-widget {
  position: relative;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 148px;
  overflow: hidden;
  border-color: rgba(198, 102, 112, 0.19);
  background:
    radial-gradient(circle at 9% 22%, rgba(249, 183, 184, 0.22), transparent 26%),
    radial-gradient(circle at 92% 85%, rgba(72, 148, 137, 0.15), transparent 30%),
    linear-gradient(135deg, rgba(255, 248, 243, 0.98), rgba(252, 244, 239, 0.94));
}

.playful-widget::after {
  position: absolute;
  right: -25px;
  bottom: -40px;
  width: 112px;
  height: 112px;
  border: 1px solid rgba(199, 92, 107, 0.14);
  border-radius: 50%;
  content: "";
}

.playful-visual {
  position: relative;
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
}

.playful-visual strong {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 18px;
  background: linear-gradient(145deg, #fff8f3, #f6d8d4);
  box-shadow: 0 13px 26px rgba(151, 79, 78, 0.17);
  font-size: 1.65rem;
  transform: rotate(-5deg);
}

.playful-orbit {
  position: absolute;
  inset: 3px;
  border: 1px dashed rgba(199, 92, 107, 0.34);
  border-radius: 50%;
  animation: playful-orbit 18s linear infinite;
}

.playful-orbit::before,
.playful-orbit::after {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  content: "";
}

.playful-orbit::before {
  top: 4px;
  left: 12px;
  background: #d46a76;
}

.playful-orbit::after {
  right: 2px;
  bottom: 15px;
  background: #35867d;
}

.playful-spark {
  position: absolute;
  z-index: 3;
  color: #d28c50;
  font-size: 0.72rem;
}

.playful-spark-one {
  top: 0;
  right: 12px;
}

.playful-spark-two {
  bottom: 5px;
  left: 5px;
  color: #c45b6b;
}

.playful-copy {
  position: relative;
  z-index: 2;
  min-width: 0;
}

.playful-copy h2 {
  margin: 4px 0 7px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.26rem, 2.4vw, 1.75rem);
  line-height: 1.08;
}

.playful-copy > p:last-child {
  max-width: 52ch;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.playful-draw-button {
  position: relative;
  z-index: 2;
  flex: none;
  white-space: nowrap;
}

.playful-draw-button.just-drawn .icon {
  animation: playful-sparkle 480ms ease;
}

@keyframes playful-orbit {
  to {
    transform: rotate(360deg);
  }
}

@keyframes playful-sparkle {
  50% {
    transform: rotate(28deg) scale(1.28);
  }
}

/* Memories are shown as keepsakes, not database rows. */
#memory-list.timeline {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(24px, 3vw, 38px);
  align-items: start;
  padding: 22px 12px 34px;
}

.memory-album-card {
  --memory-rotation: -1.2deg;
  position: relative;
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 14px 14px 20px;
  border: 1px solid rgba(112, 87, 69, 0.13);
  border-radius: 5px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.18)),
    #fffaf2;
  box-shadow: 0 18px 38px rgba(72, 53, 40, 0.12), 0 3px 8px rgba(72, 53, 40, 0.06);
  transform: rotate(var(--memory-rotation));
  transform-origin: center top;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.memory-album-card.memory-tilt-right {
  --memory-rotation: 1.1deg;
  margin-top: 22px;
}

.memory-album-card:hover,
.memory-album-card.editing {
  z-index: 3;
  box-shadow: 0 24px 48px rgba(72, 53, 40, 0.16), 0 4px 10px rgba(72, 53, 40, 0.07);
  transform: rotate(0) translateY(-3px);
}

.memory-tape {
  position: absolute;
  top: -11px;
  left: 50%;
  z-index: 4;
  width: 84px;
  height: 25px;
  border: 1px solid rgba(154, 115, 88, 0.09);
  background: rgba(239, 216, 184, 0.72);
  box-shadow: 0 2px 4px rgba(63, 45, 33, 0.06);
  transform: translateX(-50%) rotate(-2deg);
  backdrop-filter: blur(2px);
}

.memory-tape-2 {
  background: rgba(236, 182, 186, 0.62);
  transform: translateX(-50%) rotate(3deg);
}

.memory-tape-3 {
  background: rgba(176, 211, 202, 0.66);
  transform: translateX(-50%) rotate(-1deg);
}

.memory-photo-frame {
  position: relative;
  min-width: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 6px solid #fff;
  background: linear-gradient(145deg, #e7c5bd, #397d75);
  box-shadow: 0 7px 18px rgba(58, 44, 35, 0.12);
}

.memory-album-card .memory-thumb {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: linear-gradient(145deg, var(--accent, #d46f78), #327b73) !important;
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 8vw, 4.4rem);
  box-shadow: none !important;
}

.memory-album-card .memory-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 420ms ease;
}

.memory-album-card:hover .memory-thumb img {
  transform: scale(1.035);
}

.memory-photo-heart {
  position: absolute;
  right: 10px;
  bottom: 8px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 249, 243, 0.88);
  color: #c85b69;
  box-shadow: 0 5px 14px rgba(58, 44, 35, 0.14);
}

.memory-album-note {
  min-width: 0;
  padding: 0 8px;
}

.memory-album-date {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: #aa7569;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.memory-album-date i {
  color: #d49a55;
  font-style: normal;
}

.memory-album-note h3 {
  margin: 7px 0 5px;
  color: #342820;
  font-family: "Segoe Print", "Bradley Hand ITC", "Apple Chancery", cursive;
  font-size: clamp(1.12rem, 2.2vw, 1.46rem);
  line-height: 1.24;
}

.memory-album-note p {
  margin: 0;
  color: rgba(70, 54, 43, 0.73);
  font-family: "Segoe Print", "Bradley Hand ITC", "Apple Chancery", cursive;
  font-size: 0.88rem;
  line-height: 1.55;
}

.memory-card-actions {
  position: absolute;
  top: 17px;
  right: 17px;
  z-index: 5;
  display: flex;
  gap: 5px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.memory-album-card:hover .memory-card-actions,
.memory-album-card:focus-within .memory-card-actions {
  opacity: 1;
  transform: translateY(0);
}

.memory-card-actions button {
  display: grid;
  place-items: center;
  width: 34px !important;
  min-width: 34px !important;
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 !important;
  border: 1px solid rgba(79, 62, 50, 0.12) !important;
  border-radius: 50% !important;
  background: rgba(255, 252, 247, 0.92) !important;
  color: #5d5149 !important;
  box-shadow: 0 5px 12px rgba(58, 44, 35, 0.12);
}

.memory-card-actions .delete-button {
  color: #b54d5d !important;
}

.memory-card-actions .icon {
  width: 15px;
  height: 15px;
}

.memory-album-empty {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 340px;
  padding: 42px 24px;
  border: 1px dashed rgba(187, 110, 111, 0.28);
  border-radius: 24px;
  background:
    radial-gradient(circle at 25% 24%, rgba(235, 175, 178, 0.18), transparent 26%),
    radial-gradient(circle at 78% 80%, rgba(74, 145, 136, 0.13), transparent 30%),
    rgba(255, 251, 246, 0.72);
  text-align: center;
}

.memory-empty-photo {
  display: grid;
  place-items: center;
  width: 112px;
  height: 132px;
  margin-bottom: 12px;
  border: 8px solid #fff;
  background: linear-gradient(145deg, #f2ccc7, #4b8c83);
  color: #fff;
  box-shadow: 0 16px 30px rgba(65, 47, 37, 0.14);
  transform: rotate(-4deg);
}

.memory-empty-photo .icon {
  width: 42px;
  height: 42px;
}

.memory-album-empty strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
}

.memory-album-empty > span:last-child {
  max-width: 34ch;
  color: var(--muted);
  line-height: 1.55;
}

/* A softer, purpose-built login for the two existing accounts. */
.lock-card:has(#auth-form.active) > .lock-brand-default {
  display: none;
}

.lock-card:has(#auth-form.active) {
  width: min(420px, calc(100vw - 28px));
  padding: 18px;
  overflow: hidden;
  border-color: rgba(202, 109, 116, 0.2);
  border-radius: 26px;
  background:
    radial-gradient(circle at 12% 8%, rgba(242, 177, 180, 0.22), transparent 26%),
    radial-gradient(circle at 92% 90%, rgba(69, 143, 134, 0.17), transparent 30%),
    rgba(255, 250, 245, 0.97);
  box-shadow: 0 28px 70px rgba(72, 49, 38, 0.18);
}

.ourworld-login {
  gap: 15px;
}

.ourworld-login.active {
  display: grid;
}

.login-identity {
  display: flex;
  gap: 13px;
  align-items: center;
}

.login-identity img {
  width: 62px;
  height: 62px;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 10px 24px rgba(35, 18, 51, 0.2);
}

.login-identity h1 {
  margin: 0;
  color: #2b2020;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  line-height: 1;
}

.login-identity p {
  margin: 6px 0 0;
  color: #8a6f68;
  font-family: Georgia, "Times New Roman", serif;
}

.login-love-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 116px;
  height: 82px;
  margin: 0 auto -2px;
}

.login-love-mark > .icon {
  position: relative;
  z-index: 2;
  width: 30px;
  height: 30px;
  color: #d55f70;
  fill: rgba(213, 95, 112, 0.12);
}

.login-orbit {
  position: absolute;
  width: 94px;
  height: 42px;
  border: 1px solid rgba(197, 95, 111, 0.34);
  border-radius: 50%;
  transform: rotate(-12deg);
}

.login-orbit::after {
  position: absolute;
  top: 3px;
  right: 11px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d86a79;
  content: "";
}

.login-orbit-two {
  border-color: rgba(54, 132, 123, 0.32);
  transform: rotate(18deg);
}

.login-orbit-two::after {
  top: auto;
  right: auto;
  bottom: 2px;
  left: 14px;
  background: #36847b;
}

.ourworld-login label {
  color: #6e5a52;
  font-size: 0.76rem;
  letter-spacing: 0.02em;
}

.ourworld-login input {
  min-height: 50px;
  border-color: rgba(111, 83, 68, 0.16);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.76);
}

.ourworld-login input:focus {
  border-color: rgba(52, 132, 123, 0.42);
  box-shadow: 0 0 0 4px rgba(52, 132, 123, 0.09);
}

.ourworld-login .auth-actions {
  display: block;
}

.ourworld-login .auth-actions .primary-button {
  width: 100%;
  min-height: 50px;
  border-radius: 15px;
  background: linear-gradient(145deg, #246f68, #174e4a);
  box-shadow: 0 12px 24px rgba(31, 104, 97, 0.2);
}

.ourworld-login #auth-helper {
  min-height: 18px;
  margin: 0;
  color: #9b7f76;
  font-size: 0.75rem;
  text-align: center;
}

@media (max-width: 840px) {
  body.chat-active .workspace {
    grid-template-rows: minmax(0, 1fr) !important;
  }

  body.chat-active #chat-view .composer {
    grid-template-columns: 38px minmax(0, 1fr) 42px !important;
    gap: 5px !important;
    padding: 0 !important;
  }

  body.chat-active #chat-view .chat-input-shell #chat-input {
    min-height: 42px !important;
    padding: 0 44px 0 13px !important;
  }

  body.chat-active #chat-view .chat-input-shell #chat-image-button {
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
  }

  .playful-widget {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 13px;
    min-height: 0;
    padding: 16px !important;
  }

  .playful-visual {
    width: 64px;
    height: 64px;
  }

  .playful-visual strong {
    width: 46px;
    height: 46px;
    border-radius: 15px;
    font-size: 1.35rem;
  }

  .playful-copy h2 {
    font-size: 1.2rem;
  }

  .playful-copy > p:last-child {
    font-size: 0.83rem;
  }

  .playful-draw-button {
    grid-column: 1 / -1;
    justify-self: stretch;
    width: 100%;
  }

  #memory-list.timeline {
    grid-template-columns: minmax(0, 1fr);
    gap: 27px;
    padding: 19px 6px 34px !important;
  }

  .memory-album-card,
  .memory-album-card.memory-tilt-right {
    width: min(100%, 440px);
    margin: 0 auto;
    padding: 12px 12px 18px;
    transform: rotate(var(--memory-rotation));
  }

  .memory-card-actions {
    top: 15px;
    right: 15px;
    opacity: 1;
    transform: none;
  }

  .memory-album-note {
    padding: 0 5px;
  }

  .lock-screen {
    padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  }

  .lock-card:has(#auth-form.active) {
    padding: 16px;
    border-radius: 22px;
  }
}

@media (max-width: 370px) {
  body.chat-active #chat-view .composer {
    grid-template-columns: 36px minmax(0, 1fr) 40px !important;
  }

  .login-love-mark {
    height: 68px;
  }
}

/* June 11 final polish: immersive chat, compact keepsakes and app moments */
.app-splash {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 9px;
  overflow: hidden;
  background:
    radial-gradient(circle at 22% 18%, rgba(238, 174, 183, 0.3), transparent 29%),
    radial-gradient(circle at 80% 82%, rgba(62, 139, 129, 0.23), transparent 31%),
    linear-gradient(145deg, #fffaf5, #f7ece8 58%, #edf6f1);
  color: #302323;
  opacity: 1;
  transition: opacity 520ms ease, visibility 520ms ease;
}

.app-splash::before,
.app-splash::after {
  position: absolute;
  width: 42vw;
  height: 42vw;
  max-width: 360px;
  max-height: 360px;
  border: 1px solid rgba(199, 92, 107, 0.11);
  border-radius: 50%;
  content: "";
}

.app-splash::before {
  top: -18vw;
  right: -12vw;
}

.app-splash::after {
  bottom: -22vw;
  left: -14vw;
  border-color: rgba(36, 115, 107, 0.12);
}

.app-splash.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.splash-emblem {
  position: relative;
  display: grid;
  place-items: center;
  width: 154px;
  height: 154px;
  margin-bottom: 12px;
}

.splash-emblem img {
  position: relative;
  z-index: 3;
  width: 92px;
  height: 92px;
  border-radius: 27px;
  object-fit: cover;
  box-shadow: 0 24px 54px rgba(38, 20, 57, 0.24);
  animation: splash-logo-breathe 2s ease-in-out infinite;
}

.splash-orbit {
  position: absolute;
  width: 142px;
  height: 70px;
  border: 1px solid rgba(207, 93, 105, 0.42);
  border-radius: 50%;
  animation: splash-orbit-spin 4.6s linear infinite;
}

.splash-orbit-two {
  border-color: rgba(43, 127, 117, 0.38);
  animation-direction: reverse;
  animation-duration: 5.4s;
  transform: rotate(58deg);
}

.splash-heart {
  position: absolute;
  z-index: 4;
  color: #d76372;
  font-family: Georgia, serif;
  animation: splash-heart-float 1.8s ease-in-out infinite;
}

.splash-heart-one {
  top: 20px;
  right: 20px;
}

.splash-heart-two {
  bottom: 25px;
  left: 18px;
  color: #398379;
  font-size: 0.72rem;
  animation-delay: 420ms;
}

.app-splash > strong {
  position: relative;
  z-index: 2;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.1rem, 8vw, 3.25rem);
  font-weight: 600;
}

.app-splash > span {
  position: relative;
  z-index: 2;
  color: #96786f;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.96rem;
}

.splash-loading {
  display: flex;
  gap: 6px;
  margin-top: 20px;
}

.splash-loading i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #cb6471;
  animation: splash-dot 1.15s ease-in-out infinite;
}

.splash-loading i:nth-child(2) {
  background: #d5a05e;
  animation-delay: 140ms;
}

.splash-loading i:nth-child(3) {
  background: #378077;
  animation-delay: 280ms;
}

@keyframes splash-orbit-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes splash-logo-breathe {
  50% {
    transform: translateY(-3px) scale(1.025);
  }
}

@keyframes splash-heart-float {
  50% {
    opacity: 0.62;
    transform: translateY(-6px) scale(1.15);
  }
}

@keyframes splash-dot {
  50% {
    opacity: 0.35;
    transform: translateY(-5px);
  }
}

/* Chat becomes the page instead of a card inside the page. */
body.chat-active #chat-view,
body.chat-active #chat-view .chat-layout {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.chat-active .workspace {
  min-width: 0;
}

body.chat-active #chat-view.active {
  width: 100%;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.chat-active #chat-view .chat-layout {
  width: 100%;
  max-width: none !important;
  min-height: 100%;
  gap: 0 !important;
  padding: 0 !important;
}

body.chat-active #chat-view .chat-layout::before {
  display: none !important;
}

body.chat-active #chat-view .chat-status-bar {
  min-height: 58px !important;
  padding: 7px 12px !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(72, 56, 46, 0.1) !important;
  border-radius: 0 !important;
  background: rgba(255, 252, 247, 0.84) !important;
  box-shadow: none !important;
  backdrop-filter: blur(18px);
}

body.chat-active #chat-view .message-list {
  border: 0 !important;
  border-radius: 0 !important;
  background:
    radial-gradient(circle at 8% 14%, rgba(224, 242, 236, 0.36), transparent 26%),
    radial-gradient(circle at 94% 84%, rgba(248, 220, 222, 0.28), transparent 28%),
    repeating-linear-gradient(0deg, rgba(49, 39, 33, 0.015) 0 1px, transparent 1px 38px) !important;
  box-shadow: none !important;
}

body.chat-active #chat-view .chat-composer-dock {
  padding: 8px 10px 10px !important;
  border-top: 1px solid rgba(72, 56, 46, 0.09);
  background: rgba(255, 250, 245, 0.9) !important;
  box-shadow: 0 -12px 32px rgba(57, 44, 36, 0.07);
  backdrop-filter: blur(18px);
}

.message-reaction-tray {
  position: fixed;
  z-index: 2200;
  display: flex;
  gap: 4px;
  align-items: center;
  width: max-content;
  max-width: min(520px, calc(100vw - 20px));
  min-height: 54px;
  padding: 7px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  background: rgba(26, 31, 32, 0.96);
  box-shadow: 0 20px 48px rgba(20, 25, 26, 0.3);
  scrollbar-width: none;
  backdrop-filter: blur(18px);
  animation: reaction-tray-in 150ms ease-out;
  overscroll-behavior: contain;
}

.message-reaction-tray[hidden] {
  display: none !important;
}

.message-reaction-tray::-webkit-scrollbar {
  display: none;
}

.message-reaction-tray .reaction-button {
  flex: 0 0 40px;
  width: 40px;
  min-width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 1.32rem;
}

.message-reaction-tray .reaction-button:hover,
.message-reaction-tray .reaction-button.active {
  background: rgba(255, 255, 255, 0.14);
  transform: scale(1.08);
}

@keyframes reaction-tray-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.97);
  }
}

/* Toasts stay above navigation and feel like part of OurWorld. */
.toast {
  z-index: 2300;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  bottom: 24px;
  min-width: min(320px, calc(100vw - 28px));
  padding: 9px 13px 9px 9px;
  border: 1px solid rgba(199, 92, 107, 0.2);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 249, 244, 0.98), rgba(244, 236, 231, 0.97)),
    #fffaf5;
  color: #3d302a;
  box-shadow: 0 18px 44px rgba(73, 52, 42, 0.2);
  font-size: 0.88rem;
  line-height: 1.35;
  backdrop-filter: blur(18px);
}

.toast-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(145deg, #f4b6b5, #d55e70);
  color: #fff;
  box-shadow: 0 8px 18px rgba(190, 76, 94, 0.2);
}

.toast-mark .icon {
  width: 18px;
  height: 18px;
}

.toast-message {
  min-width: 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

/* A denser scrapbook mosaic. */
#memory-list.timeline {
  grid-template-columns: repeat(auto-fit, minmax(155px, 210px));
  justify-content: center;
  gap: 20px 16px;
  padding: 22px 6px 42px;
}

.memory-album-card,
.memory-album-card.memory-tilt-right {
  width: 100%;
  max-width: 210px;
  gap: 8px;
  margin: 0;
  padding: 9px 9px 13px;
  justify-self: center;
  box-shadow: 0 13px 28px rgba(72, 53, 40, 0.11), 0 2px 6px rgba(72, 53, 40, 0.05);
}

.memory-photo-frame {
  aspect-ratio: 1 / 1;
  border-width: 4px;
}

.memory-tape {
  top: -8px;
  width: 58px;
  height: 18px;
}

.memory-album-note {
  padding: 0 3px;
}

.memory-album-date {
  font-size: 0.6rem;
}

.memory-album-note h3 {
  display: -webkit-box;
  margin: 5px 0 3px;
  overflow: hidden;
  font-size: 0.94rem;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.memory-album-note p {
  display: -webkit-box;
  overflow: hidden;
  font-size: 0.72rem;
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.memory-photo-heart {
  right: 6px;
  bottom: 6px;
  width: 24px;
  height: 24px;
  font-size: 0.72rem;
}

.memory-card-actions {
  top: 11px;
  right: 11px;
}

.memory-card-actions button {
  width: 29px !important;
  min-width: 29px !important;
  height: 29px !important;
  min-height: 29px !important;
}

/* Envelopes sit together like a small letter shelf. */
.letter-grid {
  grid-template-columns: repeat(auto-fit, minmax(158px, 220px));
  justify-content: center;
  gap: 18px 14px;
  align-items: start;
}

.letter-card.envelope-card {
  width: 100%;
  max-width: 220px;
  gap: 7px;
  padding: 9px;
  justify-self: center;
  border-radius: 18px;
}

.letter-card:not(.open) .letter-envelope-scene {
  height: 142px;
}

.letter-card:not(.open) .letter-envelope {
  width: 238px;
  height: 176px;
  margin: 11px auto 0;
  transform: scale(0.72);
  transform-origin: top center;
}

.letter-card:not(.open) .letter-card-caption {
  gap: 5px;
  align-items: start;
}

.letter-card:not(.open) .letter-card-caption strong {
  font-size: 0.84rem;
  line-height: 1.25;
  white-space: normal;
}

.letter-card:not(.open) .letter-card-caption span {
  font-size: 0.64rem;
}

.letter-card:not(.open) .letter-actions {
  gap: 3px;
}

.letter-card:not(.open) .letter-actions button {
  width: 30px !important;
  min-width: 30px !important;
  height: 30px !important;
  min-height: 30px !important;
  padding: 0 !important;
}

.letter-card.open {
  grid-column: 1 / -1;
  width: min(100%, 720px);
  max-width: 720px;
  justify-self: center;
}

.letter-card.open .letter-envelope {
  transform: none !important;
}

/* Partner-designed profiles. */
.settings-form {
  display: grid;
}

.settings-form > .settings-overview {
  order: 0;
}

.settings-form > .settings-section:not(.profile-settings-section):not(.push-settings-section) {
  order: 4;
}

.settings-form > .composer-status {
  order: 5;
}

.settings-form > .modal-actions {
  order: 6;
}

.profile-settings-section {
  position: relative;
}

.profile-settings-section.profile-editable {
  border-color: rgba(199, 92, 107, 0.22);
  background:
    radial-gradient(circle at 95% 10%, rgba(243, 183, 185, 0.18), transparent 26%),
    linear-gradient(145deg, rgba(255, 251, 246, 0.98), rgba(248, 240, 235, 0.92));
}

.profile-settings-section.profile-editable::after {
  position: absolute;
  top: 14px;
  right: 18px;
  color: rgba(199, 92, 107, 0.22);
  content: "♥";
  font-family: Georgia, serif;
  font-size: 1.4rem;
}

.profile-settings-section.profile-owned {
  opacity: 0.74;
}

.profile-settings-section.profile-owned .settings-section-heading::after {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(73, 61, 53, 0.07);
  color: var(--muted);
  content: "Partner kujundab";
  font-size: 0.66rem;
  font-weight: 850;
}

.push-settings-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.push-settings-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 17px;
  background: #150e2c;
  box-shadow: 0 10px 22px rgba(34, 20, 48, 0.18);
}

.push-settings-icon img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.push-settings-card > div {
  min-width: 0;
}

.push-settings-card strong {
  display: block;
  margin-bottom: 4px;
}

.push-settings-card p {
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.45;
}

#push-status-badge[data-active="true"] {
  background: rgba(218, 239, 232, 0.9);
  color: var(--teal);
}

#push-enable-button.is-active {
  border-color: rgba(199, 92, 107, 0.2);
  background: rgba(255, 237, 235, 0.82);
  color: #a64758;
}

/* Login fields become small illustrated portals instead of office inputs. */
.ourworld-login {
  gap: 13px;
}

.login-welcome {
  max-width: 28ch;
  margin: -4px auto 2px;
  color: #8d7169;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
  line-height: 1.45;
  text-align: center;
}

.ourworld-login .login-field {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 62px;
  padding: 7px 10px;
  border: 1px solid rgba(126, 91, 75, 0.14);
  border-radius: 19px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(255, 246, 242, 0.68));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.84), 0 9px 22px rgba(75, 53, 42, 0.06);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.ourworld-login .login-field:focus-within {
  border-color: rgba(53, 132, 122, 0.34);
  box-shadow: 0 0 0 4px rgba(53, 132, 122, 0.08), 0 12px 26px rgba(75, 53, 42, 0.08);
  transform: translateY(-1px);
}

.login-field-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(242, 188, 187, 0.74), rgba(255, 239, 232, 0.82));
  color: #b04d60;
}

.login-field:nth-of-type(2) .login-field-icon {
  background: linear-gradient(145deg, rgba(184, 220, 211, 0.8), rgba(235, 246, 240, 0.9));
  color: #26766d;
}

.login-field-icon .icon {
  width: 19px;
  height: 19px;
}

.login-field-body {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.login-field-body small {
  color: #9a756b;
  font-size: 0.64rem;
  font-weight: 850;
  text-transform: uppercase;
}

.ourworld-login .login-field input {
  width: 100%;
  min-height: 30px;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0;
  outline: 0;
  background: transparent !important;
  box-shadow: none !important;
  color: #372a25;
  font-size: 0.92rem;
}

.lock-card:has(#auth-form.active)::after {
  position: absolute;
  right: -18px;
  bottom: 48px;
  color: rgba(199, 92, 107, 0.08);
  content: "♥";
  font-family: Georgia, serif;
  font-size: 8rem;
  line-height: 1;
  pointer-events: none;
  transform: rotate(-12deg);
}

.ourworld-login > * {
  position: relative;
  z-index: 2;
}

@media (max-width: 840px) {
  body.chat-active .app-shell {
    padding: env(safe-area-inset-top) 0 calc(72px + env(safe-area-inset-bottom)) !important;
  }

  body.chat-active #chat-view .chat-status-bar {
    padding-right: 15px !important;
    padding-left: 15px !important;
  }

  body.chat-active #chat-view .message-list {
    padding: 12px 14px 24px !important;
  }

  body.chat-active #chat-view .chat-composer-dock {
    padding-right: 10px !important;
    padding-bottom: 10px !important;
    padding-left: 10px !important;
  }

  body.chat-active #chat-view .message-footer {
    top: 50% !important;
    bottom: auto !important;
    width: max-content !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateY(-50%) !important;
  }

  body.chat-active #chat-view .message.mine .message-footer {
    right: calc(100% + 4px) !important;
    left: auto !important;
  }

  body.chat-active #chat-view .message.theirs .message-footer {
    right: auto !important;
    left: calc(100% + 4px) !important;
  }

  body.chat-active #chat-view .message-action-row {
    gap: 1px !important;
    padding: 2px !important;
    border: 0 !important;
    background: rgba(255, 252, 247, 0.82) !important;
    box-shadow: 0 6px 16px rgba(54, 41, 32, 0.08) !important;
  }

  body.chat-active #chat-view .message-action {
    width: 27px !important;
    min-width: 27px !important;
    height: 27px !important;
    min-height: 27px !important;
    color: rgba(49, 45, 41, 0.64) !important;
  }

  .message-reaction-tray {
    width: max-content;
    max-width: calc(100vw - 20px);
  }

  .toast {
    bottom: calc(86px + env(safe-area-inset-bottom));
    width: auto;
    max-width: calc(100vw - 24px);
  }

  body.chat-active .toast {
    bottom: calc(146px + env(safe-area-inset-bottom));
  }

  #memory-list.timeline {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 17px 11px !important;
    padding: 18px 2px 34px !important;
  }

  .memory-album-card,
  .memory-album-card.memory-tilt-right {
    width: 100%;
    max-width: 190px;
    padding: 8px 8px 12px;
  }

  .memory-card-actions {
    top: 9px;
    right: 9px;
  }

  .letter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 15px 10px !important;
  }

  .letter-card.envelope-card {
    max-width: 190px;
  }

  .letter-card.open {
    grid-column: 1 / -1 !important;
    max-width: none;
  }

  .push-settings-card {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .push-settings-icon {
    width: 48px;
    height: 48px;
    border-radius: 15px;
  }

  .push-settings-card .soft-button {
    grid-column: 1 / -1;
    width: 100%;
  }
}

.message-more-menu {
  position: relative;
}

.message-more-menu > summary {
  list-style: none;
  cursor: pointer;
}

.message-more-menu > summary::-webkit-details-marker {
  display: none;
}

.message-more-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 7px);
  z-index: 20;
  display: grid;
  min-width: 126px;
  padding: 5px;
  border: 1px solid rgba(74, 55, 45, 0.11);
  border-radius: 13px;
  background: rgba(255, 252, 247, 0.98);
  box-shadow: 0 16px 34px rgba(58, 43, 34, 0.17);
  backdrop-filter: blur(18px);
}

.message-more-menu:not([open]) .message-more-popover {
  display: none;
}

.message-more-popover button {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 7px 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #493c36;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  text-align: left;
}

.message-more-popover button:hover {
  background: rgba(62, 128, 118, 0.08);
}

.message-more-popover button.danger {
  color: #b84e5e;
}

.message-more-popover .icon {
  width: 15px;
  height: 15px;
}

/* Closed letters stay tidy on the compact two-column shelf. */
.letter-card:not(.open) {
  position: relative;
  overflow: hidden;
}

.letter-card:not(.open) .letter-envelope-scene {
  overflow: hidden;
  border-radius: 14px;
}

.letter-card:not(.open) .letter-envelope {
  transform: scale(0.68);
}

.letter-card:not(.open) .letter-paper-kicker,
.letter-card:not(.open) .letter-paper strong,
.letter-card:not(.open) .letter-paper-body {
  visibility: hidden;
}

.letter-card:not(.open) .letter-card-caption {
  position: static !important;
  display: block;
  min-height: 48px;
  padding: 1px 4px 3px;
}

.letter-card:not(.open) .letter-card-caption > div:first-child {
  display: grid;
  gap: 3px;
}

.letter-card:not(.open) .letter-card-caption strong {
  display: -webkit-box;
  overflow: hidden;
  text-overflow: clip;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.letter-card:not(.open) .letter-card-caption span {
  display: block;
}

.letter-card:not(.open) .letter-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  display: flex;
  gap: 4px;
}

.letter-card:not(.open) .letter-actions button {
  border: 1px solid rgba(126, 79, 68, 0.1) !important;
  background: rgba(255, 252, 247, 0.94) !important;
  box-shadow: 0 5px 12px rgba(70, 48, 39, 0.1);
}

@media (max-width: 360px) {
  #memory-list.timeline,
  .letter-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .memory-album-card,
  .letter-card.envelope-card {
    max-width: 230px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .splash-emblem img,
  .splash-orbit,
  .splash-heart,
  .splash-loading i {
    animation: none !important;
  }
}

/* June 12: seamless launch, romantic chrome, illustrated chat and couple game */
.app-splash {
  background:
    linear-gradient(128deg, rgba(255, 236, 235, 0.78), transparent 42%),
    linear-gradient(318deg, rgba(224, 241, 234, 0.72), transparent 45%),
    #fff8f3;
}

.splash-emblem img {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  box-shadow: 0 20px 46px rgba(116, 72, 88, 0.14);
}

.splash-emblem {
  width: 166px;
  height: 166px;
}

.splash-orbit {
  width: 158px;
  height: 78px;
}

.app-splash > strong {
  color: #6f4057;
  font-family: "Segoe Script", "Brush Script MT", Georgia, serif;
  font-weight: 600;
  letter-spacing: 0;
}

body:not(.is-locked) {
  background:
    linear-gradient(112deg, rgba(229, 243, 236, 0.92), transparent 37%),
    linear-gradient(292deg, rgba(255, 226, 229, 0.76), transparent 39%),
    linear-gradient(180deg, #fffaf6, #f8f3ec);
}

body:not(.is-locked):not(.chat-active) .topbar {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.mobile-wordmark {
  gap: 8px;
}

.mobile-wordmark .brand-mark {
  width: 43px;
  height: 43px;
  border-radius: 50%;
  background-image: url("assets/ourworld-icon-light-192.png") !important;
  background-size: cover;
  box-shadow: 0 9px 24px rgba(126, 74, 91, 0.13);
}

.mobile-wordmark strong {
  color: #75445b;
  font-family: "Segoe Script", "Brush Script MT", Georgia, serif;
  font-size: 1.38rem;
  font-weight: 600;
  letter-spacing: 0;
}

body:not(.chat-active) .app-menu-button {
  border-color: rgba(130, 83, 93, 0.13) !important;
  border-radius: 50% !important;
  background: rgba(255, 252, 248, 0.72) !important;
  color: #865368 !important;
  box-shadow: 0 8px 22px rgba(108, 68, 80, 0.08) !important;
  backdrop-filter: blur(15px);
}

#home-view .pulse-widget,
#home-view .mood-widget,
#home-view .playful-widget,
#home-view .question-widget,
#home-view .intimacy-game-widget {
  border: 1px solid rgba(126, 80, 84, 0.12);
  box-shadow:
    0 18px 38px rgba(81, 57, 50, 0.09),
    0 2px 7px rgba(174, 112, 119, 0.05);
}

body.chat-active #chat-view .chat-status-bar {
  position: relative;
  min-height: 68px !important;
  overflow: hidden;
  padding: 8px 18px !important;
  border-bottom: 1px solid rgba(119, 72, 82, 0.1) !important;
  background:
    linear-gradient(102deg, rgba(255, 236, 235, 0.92), rgba(255, 251, 246, 0.94) 52%, rgba(226, 242, 235, 0.92)) !important;
  box-shadow: 0 9px 26px rgba(84, 58, 53, 0.07) !important;
}

body.chat-active #chat-view .chat-status-main {
  position: relative;
  z-index: 3;
}

body.chat-active #chat-view .chat-contact-avatar {
  width: 47px;
  height: 47px;
}

body.chat-active #chat-view .chat-contact-avatar::before {
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(208, 101, 120, 0.2);
  border-radius: 50%;
  content: "";
}

body.chat-active #chat-view .chat-contact-copy {
  gap: 0;
}

body.chat-active #chat-view .chat-contact-copy h2 {
  color: #3f302f;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.28rem;
}

body.chat-active #chat-view .chat-contact-copy > span {
  display: none !important;
}

.chat-love-orbit {
  position: absolute;
  right: 28px;
  width: 116px;
  height: 38px;
  border: 1px solid rgba(202, 93, 112, 0.2);
  border-radius: 50%;
  pointer-events: none;
}

.chat-love-orbit-one {
  top: 15px;
  transform: rotate(-11deg);
}

.chat-love-orbit-two {
  top: 13px;
  border-color: rgba(52, 127, 115, 0.18);
  transform: rotate(27deg);
}

.chat-love-heart {
  position: absolute;
  top: 22px;
  right: 70px;
  z-index: 2;
  color: #d46a7b;
  font-family: Georgia, serif;
  font-size: 1.02rem;
}

.chat-love-spark {
  position: absolute;
  top: 12px;
  right: 25px;
  color: #ba8b48;
  font-size: 0.72rem;
}

.message-more-tray {
  position: fixed;
  z-index: 2300;
  display: grid;
  width: 142px;
  padding: 6px;
  border: 1px solid rgba(100, 65, 69, 0.12);
  border-radius: 16px;
  background: rgba(255, 251, 247, 0.98);
  box-shadow: 0 20px 48px rgba(55, 39, 35, 0.2);
  backdrop-filter: blur(18px);
}

.message-more-tray[hidden] {
  display: none !important;
}

.message-more-tray button {
  display: flex;
  gap: 9px;
  align-items: center;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #493b37;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: left;
}

.message-more-tray button:hover,
.message-more-tray button:focus-visible {
  background: rgba(50, 126, 115, 0.08);
}

.message-more-tray button.danger {
  color: #ba5362;
}

.message-more-tray .icon {
  width: 16px;
  height: 16px;
}

.intimacy-game-widget {
  position: relative;
  grid-column: 1 / -1;
  min-height: 250px;
  overflow: hidden;
  padding: 24px;
  background:
    linear-gradient(118deg, rgba(255, 242, 239, 0.98), rgba(255, 251, 246, 0.98) 56%, rgba(235, 245, 239, 0.96));
}

.intimacy-game-widget::before {
  position: absolute;
  right: -48px;
  bottom: -76px;
  width: 230px;
  height: 230px;
  border: 1px solid rgba(203, 101, 119, 0.14);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.intimacy-game-heading {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.intimacy-game-heading h2 {
  margin: 2px 0 0;
  color: #553642;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.75rem;
}

.adult-badge {
  display: grid;
  place-items: center;
  min-width: 39px;
  height: 27px;
  padding: 0 8px;
  border: 1px solid rgba(186, 79, 99, 0.18);
  border-radius: 999px;
  background: rgba(255, 239, 238, 0.86);
  color: #ae5264;
  font-size: 0.7rem;
  font-weight: 900;
}

.intimacy-orbit {
  position: relative;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  gap: 13px;
  align-items: center;
  width: min(230px, 82%);
  margin: 18px auto 13px;
}

.intimacy-orbit::before,
.intimacy-orbit::after {
  position: absolute;
  inset: 7px 22px;
  border: 1px solid rgba(205, 95, 115, 0.25);
  border-radius: 50%;
  content: "";
  transform: rotate(-8deg);
}

.intimacy-orbit::after {
  border-color: rgba(45, 124, 112, 0.21);
  transform: rotate(19deg);
}

.intimacy-orbit span,
.intimacy-orbit i {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
}

.intimacy-orbit span {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2c756d;
  color: #fff;
  font-family: Georgia, serif;
  font-size: 1rem;
  box-shadow: 0 8px 20px rgba(45, 116, 107, 0.18);
}

.intimacy-orbit span:last-child {
  background: #d0697a;
}

.intimacy-orbit i {
  color: #d25d73;
  font-family: Georgia, serif;
  font-size: 1.18rem;
  font-style: normal;
}

.intimacy-intro {
  position: relative;
  z-index: 2;
  max-width: 520px;
  margin: 0 auto 18px;
  color: #806a66;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.55;
  text-align: center;
}

.intimacy-controls {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.intimacy-controls[hidden],
.intimacy-card[hidden],
.intimacy-actions [hidden] {
  display: none !important;
}

.intimacy-segment,
.intimacy-levels {
  display: grid;
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(119, 80, 79, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
}

.intimacy-segment {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.intimacy-segment button,
.intimacy-levels button {
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #765e5b;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 850;
}

.intimacy-segment button.active {
  background: #315f5b;
  color: #fff;
  box-shadow: 0 8px 18px rgba(49, 95, 91, 0.18);
}

.intimacy-levels button.active {
  background: #f4d9d8;
  color: #a3485b;
}

.intimacy-card {
  position: relative;
  z-index: 2;
  min-height: 126px;
  padding: 19px 20px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 18px;
  background: linear-gradient(138deg, #593c58, #326864);
  color: #fffaf5;
  box-shadow: 0 18px 34px rgba(65, 49, 66, 0.18);
}

.intimacy-card span {
  color: #f7c6ce;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.intimacy-card p {
  margin: 12px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.12rem;
  line-height: 1.48;
}

.intimacy-actions {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
}

.intimacy-start {
  min-width: 190px;
}

.intimacy-pass {
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: #8a6666;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
}

@media (max-width: 840px) {
  body:not(.chat-active) .topbar {
    min-height: 62px !important;
    padding: 7px 13px 5px !important;
    border-radius: 0 !important;
  }

  .mobile-wordmark {
    display: flex !important;
  }

  #home-view .home-grid {
    gap: 12px !important;
  }

  body.chat-active #chat-view .chat-status-bar {
    min-height: 64px !important;
    padding: 7px 14px !important;
  }

  .chat-love-orbit {
    right: 13px;
    width: 96px;
  }

  .chat-love-heart {
    right: 48px;
  }

  .chat-love-spark {
    right: 11px;
  }

  .intimacy-game-widget {
    min-height: 222px;
    padding: 18px 15px;
  }

  .intimacy-game-heading h2 {
    font-size: 1.48rem;
  }

  .intimacy-orbit {
    margin-top: 12px;
    margin-bottom: 10px;
  }

  .intimacy-intro {
    margin-bottom: 14px;
    font-size: 0.88rem;
  }

  .intimacy-card {
    min-height: 112px;
    padding: 16px;
  }

  .intimacy-card p {
    font-size: 1rem;
  }

  .intimacy-actions {
    flex-wrap: wrap;
  }
}

/* June 12: the memories view becomes a real page-turning keepsake album. */
#memories-view .collection-header {
  width: min(100%, 1040px);
  margin-right: auto;
  margin-left: auto;
}

#memories-view .collection-layout {
  gap: 14px;
}

#memory-list.memory-book-stage {
  display: block !important;
  width: min(100%, 1040px);
  max-width: none;
  margin: 0 auto;
  padding: 0 2px 26px !important;
}

.memory-book-shell {
  display: grid;
  gap: 13px;
  width: 100%;
}

.memory-book-toolbar {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 4px 9px;
}

.memory-book-summary {
  display: grid;
  gap: 2px;
}

.memory-book-summary span {
  color: #a5756d;
  font-size: 0.65rem;
  font-weight: 900;
  text-transform: uppercase;
}

.memory-book-summary strong {
  color: #4c3a35;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-weight: 600;
}

.memory-book-navigation {
  display: grid;
  grid-template-columns: 38px minmax(64px, auto) 38px;
  gap: 8px;
  align-items: center;
}

.memory-book-nav {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(104, 75, 61, 0.13);
  border-radius: 50%;
  background: rgba(255, 252, 247, 0.86);
  color: #326f68;
  box-shadow: 0 8px 18px rgba(69, 50, 40, 0.08);
}

.memory-book-nav.previous .icon {
  transform: rotate(180deg);
}

.memory-book-nav .icon {
  width: 17px;
  height: 17px;
}

.memory-book-nav:disabled {
  opacity: 0.3;
  box-shadow: none;
}

.memory-book-page-label {
  color: #7e6860;
  font-size: 0.75rem;
  font-weight: 850;
  text-align: center;
}

.memory-book {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  height: clamp(520px, 64vh, 650px);
  min-height: 0;
  padding: 13px;
  border: 1px solid rgba(77, 51, 42, 0.16);
  border-radius: 8px;
  outline: 0;
  background:
    linear-gradient(90deg, #715449, #9d7460 2.4%, #65483f 3.4%, #65483f 96.6%, #9d7460 97.6%, #715449),
    #765548;
  box-shadow:
    0 28px 64px rgba(72, 49, 39, 0.18),
    0 7px 17px rgba(72, 49, 39, 0.11);
  perspective: 1500px;
}

.memory-book::before {
  position: absolute;
  inset: 6px;
  z-index: -1;
  border: 1px solid rgba(255, 235, 211, 0.17);
  border-radius: 5px;
  content: "";
  pointer-events: none;
}

.memory-book::after {
  position: absolute;
  top: 13px;
  bottom: 13px;
  left: 50%;
  z-index: 8;
  width: 20px;
  content: "";
  pointer-events: none;
  transform: translateX(-50%);
  background:
    linear-gradient(90deg, rgba(83, 56, 44, 0.18), rgba(255, 255, 255, 0.64) 42%, rgba(82, 55, 44, 0.2));
  filter: blur(3px);
  opacity: 0.72;
}

.memory-book-ribbon {
  position: absolute;
  top: 3px;
  bottom: -15px;
  left: calc(50% + 12px);
  z-index: 10;
  width: 13px;
  background: linear-gradient(90deg, #a74357, #d76d7d 55%, #923849);
  box-shadow: 0 5px 9px rgba(82, 34, 45, 0.2);
  clip-path: polygon(0 0, 100% 0, 100% 96%, 50% 100%, 0 96%);
  pointer-events: none;
}

.memory-book-page {
  position: relative;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  padding: clamp(22px, 3vw, 38px) clamp(20px, 3vw, 36px) 32px;
  background:
    repeating-linear-gradient(0deg, rgba(111, 83, 66, 0.018) 0 1px, transparent 1px 28px),
    linear-gradient(145deg, rgba(255, 255, 255, 0.42), transparent 38%),
    #fffaf0;
  color: #49382f;
  box-shadow: inset 0 0 36px rgba(111, 83, 61, 0.08);
  transform-style: preserve-3d;
}

.memory-book-page-left {
  border-radius: 5px 0 0 5px;
  box-shadow:
    inset -16px 0 24px rgba(93, 65, 48, 0.08),
    inset 0 0 36px rgba(111, 83, 61, 0.08);
}

.memory-book-page-right {
  border-radius: 0 5px 5px 0;
  box-shadow:
    inset 16px 0 24px rgba(93, 65, 48, 0.08),
    inset 0 0 36px rgba(111, 83, 61, 0.08);
}

.memory-book-turn-forward .memory-book-page-right {
  animation: memory-page-forward 420ms cubic-bezier(0.2, 0.72, 0.24, 1);
  transform-origin: left center;
}

.memory-book-turn-backward .memory-book-page-left {
  animation: memory-page-backward 420ms cubic-bezier(0.2, 0.72, 0.24, 1);
  transform-origin: right center;
}

@keyframes memory-page-forward {
  from {
    opacity: 0.62;
    transform: rotateY(-12deg) translateX(8px);
  }
  to {
    opacity: 1;
    transform: rotateY(0) translateX(0);
  }
}

@keyframes memory-page-backward {
  from {
    opacity: 0.62;
    transform: rotateY(12deg) translateX(-8px);
  }
  to {
    opacity: 1;
    transform: rotateY(0) translateX(0);
  }
}

.memory-page-content {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: clamp(14px, 2.2vh, 22px);
  height: 100%;
  min-height: 0;
}

.memory-page-content.editing::after {
  position: absolute;
  inset: -12px;
  border: 1px dashed rgba(197, 88, 105, 0.38);
  content: "";
  pointer-events: none;
}

.memory-page-photo {
  position: relative;
  align-self: center;
  justify-self: center;
  width: min(100%, 360px);
  min-height: 0;
  padding: 8px 8px 25px;
  background: #fff;
  box-shadow:
    0 17px 30px rgba(75, 53, 40, 0.15),
    0 3px 8px rgba(75, 53, 40, 0.08);
  transform: rotate(-1.4deg);
}

.memory-page-layout-landscape .memory-page-photo {
  width: min(100%, 390px);
  padding-bottom: 20px;
  transform: rotate(1.2deg);
}

.memory-page-layout-postcard .memory-page-photo {
  width: min(91%, 340px);
  transform: rotate(-2.2deg);
}

.memory-page-photo-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: linear-gradient(145deg, var(--memory-accent), #3e8178);
  color: #fff;
}

.memory-page-layout-portrait .memory-page-photo-button {
  aspect-ratio: 4 / 5;
}

.memory-page-layout-landscape .memory-page-photo-button {
  aspect-ratio: 4 / 3;
}

.memory-page-layout-postcard .memory-page-photo-button {
  aspect-ratio: 1 / 1;
}

.memory-page-photo-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 420ms ease;
}

.memory-page-photo-button:hover img {
  transform: scale(1.035);
}

.memory-page-photo-placeholder {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--memory-accent) 82%, white), #34766f);
  font-family: Georgia, "Times New Roman", serif;
}

.memory-page-photo-placeholder > span {
  font-size: clamp(2.4rem, 7vw, 5rem);
}

.memory-page-photo-placeholder > i {
  position: absolute;
  right: 13px;
  bottom: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-style: normal;
}

.memory-page-tape {
  position: absolute;
  top: -12px;
  left: 50%;
  z-index: 4;
  width: 84px;
  height: 24px;
  border: 1px solid rgba(122, 89, 64, 0.06);
  background: rgba(237, 213, 177, 0.7);
  box-shadow: 0 2px 4px rgba(73, 52, 38, 0.05);
  transform: translateX(-50%) rotate(-2deg);
  backdrop-filter: blur(2px);
}

.memory-page-tape-2 {
  background: rgba(232, 177, 183, 0.58);
  transform: translateX(-50%) rotate(3deg);
}

.memory-page-tape-3 {
  background: rgba(167, 207, 196, 0.64);
  transform: translateX(-50%) rotate(-1deg);
}

.memory-page-photo-mark {
  position: absolute;
  right: 13px;
  bottom: 3px;
  color: #c85568;
  font-family: Georgia, serif;
  font-size: 0.9rem;
}

.memory-page-copy {
  position: relative;
  min-width: 0;
  padding: 0 4px 0 7px;
}

.memory-page-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  color: #aa746b;
  font-size: 0.65rem;
  font-weight: 850;
  text-transform: uppercase;
}

.memory-page-meta i {
  color: #c89147;
  font-style: normal;
}

.memory-page-copy h3 {
  display: -webkit-box;
  margin: 7px 0 6px;
  overflow: hidden;
  color: #3f3029;
  font-family: "Segoe Print", "Bradley Hand ITC", "Apple Chancery", cursive;
  font-size: clamp(1.08rem, 2.1vw, 1.52rem);
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.memory-page-copy p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: rgba(72, 55, 45, 0.72);
  font-family: "Segoe Print", "Bradley Hand ITC", "Apple Chancery", cursive;
  font-size: clamp(0.76rem, 1.25vw, 0.94rem);
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.memory-page-author {
  position: absolute;
  right: 1px;
  bottom: 0;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid rgba(113, 77, 63, 0.13);
  border-radius: 50%;
  background: rgba(255, 250, 241, 0.88);
  color: #33776f;
  font-family: Georgia, serif;
  font-size: 0.68rem;
  font-weight: 800;
  box-shadow: 0 5px 12px rgba(70, 50, 40, 0.08);
}

.memory-page-actions {
  position: absolute;
  top: -11px;
  right: -10px;
  z-index: 6;
  display: flex;
  gap: 5px;
  opacity: 0.16;
  transition: opacity 150ms ease;
}

.memory-page-content:hover .memory-page-actions,
.memory-page-content:focus-within .memory-page-actions {
  opacity: 1;
}

.memory-page-actions button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(90, 65, 52, 0.12);
  border-radius: 50%;
  background: rgba(255, 252, 246, 0.94);
  color: #5c4c44;
  box-shadow: 0 7px 16px rgba(65, 45, 35, 0.11);
}

.memory-page-actions button.danger {
  color: #b34b5b;
}

.memory-page-actions .icon {
  width: 14px;
  height: 14px;
}

.memory-page-number {
  position: absolute;
  bottom: 9px;
  color: rgba(102, 76, 61, 0.45);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.68rem;
}

.memory-book-page-left .memory-page-number {
  left: 17px;
}

.memory-book-page-right .memory-page-number {
  right: 17px;
}

.memory-page-decoration {
  position: absolute;
  bottom: 6px;
  left: 50%;
  color: rgba(163, 104, 91, 0.22);
  font-family: Georgia, serif;
  font-size: 1.3rem;
  transform: translateX(-50%);
}

.memory-book-page-empty {
  display: grid;
  place-items: center;
}

.memory-blank-note {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 8px;
  width: min(250px, 80%);
  padding: 23px 20px;
  border: 1px solid rgba(177, 105, 107, 0.13);
  background: rgba(255, 244, 236, 0.56);
  text-align: center;
  transform: rotate(1.4deg);
}

.memory-blank-note span {
  color: #b0736d;
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: uppercase;
}

.memory-blank-note strong {
  color: #665049;
  font-family: "Segoe Print", "Bradley Hand ITC", cursive;
  font-size: 1rem;
  line-height: 1.45;
}

.memory-page-heart {
  position: absolute;
  top: 22%;
  right: 19%;
  color: rgba(199, 83, 101, 0.18);
  font-family: Georgia, serif;
  font-size: 2rem;
  transform: rotate(9deg);
}

.memory-page-flower {
  position: absolute;
  right: 12%;
  bottom: 12%;
  width: 72px;
  height: 120px;
  border-left: 2px solid rgba(83, 126, 98, 0.3);
  transform: rotate(24deg);
}

.memory-page-flower i {
  position: absolute;
  width: 31px;
  height: 15px;
  border: 1px solid rgba(83, 126, 98, 0.22);
  border-radius: 100% 0 100% 0;
  background: rgba(193, 218, 193, 0.22);
}

.memory-page-flower i:nth-child(1) {
  top: 22px;
  left: -31px;
}

.memory-page-flower i:nth-child(2) {
  top: 45px;
  left: 0;
  transform: scaleX(-1);
}

.memory-page-flower i:nth-child(3) {
  top: 69px;
  left: -31px;
}

.memory-page-flower i:nth-child(4) {
  top: -8px;
  left: -17px;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: rgba(224, 157, 166, 0.18);
}

.memory-book-dots {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  min-height: 24px;
}

.memory-book-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(123, 91, 76, 0.24);
  transition: width 160ms ease, background 160ms ease;
}

.memory-book-dot.active {
  width: 23px;
  border-radius: 999px;
  background: #c85a6a;
}

.memory-book-dot-gap {
  color: rgba(103, 78, 67, 0.48);
  font-size: 0.72rem;
}

.memory-book-shell-empty {
  place-items: center;
  min-height: min(610px, 68vh);
}

.memory-album-cover {
  position: relative;
  display: grid;
  justify-items: center;
  width: min(470px, calc(100vw - 42px));
  min-height: 500px;
  padding: 58px 42px 46px;
  overflow: hidden;
  border: 1px solid rgba(255, 223, 214, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.04), transparent 38%),
    #154c4c;
  color: #fff7ef;
  box-shadow:
    15px 18px 0 #79584b,
    0 32px 70px rgba(50, 36, 31, 0.24);
  text-align: center;
}

.memory-album-cover::before {
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(238, 187, 135, 0.36);
  content: "";
  pointer-events: none;
}

.memory-cover-monogram {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 52px 34px 52px;
  gap: 8px;
  align-items: center;
  margin: 40px 0 48px;
}

.memory-cover-monogram::before,
.memory-cover-monogram::after {
  position: absolute;
  inset: -25px -56px;
  border: 1px solid rgba(232, 155, 168, 0.52);
  border-radius: 50%;
  content: "";
  transform: rotate(-13deg);
}

.memory-cover-monogram::after {
  border-color: rgba(204, 164, 104, 0.48);
  transform: rotate(28deg);
}

.memory-cover-monogram span,
.memory-cover-monogram i {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
}

.memory-cover-monogram span {
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
  font-family: Georgia, serif;
  font-size: 1.35rem;
}

.memory-cover-monogram i {
  color: #e88da0;
  font-family: Georgia, serif;
  font-size: 1.25rem;
  font-style: normal;
}

.memory-album-cover > .eyebrow {
  color: #e6b76f;
}

.memory-album-cover h3 {
  margin: 7px 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 500;
}

.memory-album-cover > p:not(.eyebrow) {
  max-width: 31ch;
  margin: 0 0 28px;
  color: rgba(255, 247, 239, 0.7);
  font-family: Georgia, serif;
  line-height: 1.6;
}

.memory-cover-orbit {
  position: absolute;
  width: 190px;
  height: 82px;
  border: 1px solid rgba(233, 143, 160, 0.18);
  border-radius: 50%;
}

.memory-cover-orbit-one {
  top: 64px;
  right: -70px;
  transform: rotate(31deg);
}

.memory-cover-orbit-two {
  bottom: 45px;
  left: -84px;
  border-color: rgba(221, 180, 111, 0.18);
  transform: rotate(-22deg);
}

.memory-cover-spark {
  position: absolute;
  color: #d8a95f;
}

.memory-cover-spark-one {
  top: 60px;
  left: 58px;
}

.memory-cover-spark-two {
  right: 54px;
  bottom: 54px;
  color: #e68799;
}

.memory-detail-active .media-modal-card {
  width: min(760px, calc(100vw - 28px));
  border-color: rgba(140, 91, 70, 0.13);
  border-radius: 8px;
  background:
    repeating-linear-gradient(0deg, rgba(105, 79, 61, 0.018) 0 1px, transparent 1px 30px),
    #fff9ee;
  box-shadow: 0 32px 78px rgba(57, 40, 33, 0.28);
}

.memory-detail-active .media-viewer {
  padding: 13px 13px 34px;
  border: 0;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 15px 32px rgba(70, 49, 38, 0.15);
  transform: rotate(-0.5deg);
}

.memory-detail-active .media-copy strong {
  color: #a46a63;
}

.memory-detail-active .media-copy p {
  font-family: "Segoe Print", "Bradley Hand ITC", cursive;
  line-height: 1.7;
}

@media (min-width: 841px) {
  .memory-page-layout-portrait .memory-page-photo {
    width: min(74%, 250px);
  }
}

@media (max-width: 840px) {
  #memories-view .collection-header {
    margin-bottom: 3px;
    padding-right: 5px;
    padding-left: 5px;
  }

  #memory-list.memory-book-stage {
    padding: 0 0 13px !important;
  }

  .memory-book-shell {
    gap: 7px;
  }

  .memory-book-toolbar {
    min-height: 40px;
    padding: 0 5px;
  }

  .memory-book-summary span {
    font-size: 0.58rem;
  }

  .memory-book-summary strong {
    font-size: 0.88rem;
  }

  .memory-book-navigation {
    grid-template-columns: 34px 54px 34px;
    gap: 5px;
  }

  .memory-book-nav {
    width: 34px;
    height: 34px;
  }

  .memory-book {
    height: clamp(400px, 61dvh, 520px);
    padding: 8px;
    border-radius: 7px;
  }

  .memory-book::after {
    top: 8px;
    bottom: 8px;
    width: 14px;
  }

  .memory-book-ribbon {
    left: calc(50% + 8px);
    width: 9px;
  }

  .memory-book-page {
    padding: 18px 10px 25px;
  }

  .memory-page-content {
    gap: 10px;
  }

  .memory-page-photo {
    width: 100%;
    padding: 5px 5px 17px;
  }

  .memory-page-layout-postcard .memory-page-photo {
    width: 93%;
  }

  .memory-page-tape {
    top: -8px;
    width: 46px;
    height: 15px;
  }

  .memory-page-photo-mark {
    right: 8px;
    bottom: 0;
    font-size: 0.7rem;
  }

  .memory-page-copy {
    padding: 0 2px;
  }

  .memory-page-meta {
    font-size: 0.52rem;
  }

  .memory-page-copy h3 {
    margin: 5px 0 4px;
    font-size: clamp(0.82rem, 4vw, 1rem);
    line-height: 1.2;
  }

  .memory-page-copy p {
    padding-right: 19px;
    font-size: clamp(0.62rem, 2.8vw, 0.74rem);
    line-height: 1.38;
    -webkit-line-clamp: 3;
  }

  .memory-page-author {
    width: 20px;
    height: 20px;
    font-size: 0.55rem;
  }

  .memory-page-actions {
    top: -8px;
    right: -5px;
    gap: 3px;
    opacity: 0.82;
  }

  .memory-page-actions button {
    width: 27px;
    height: 27px;
  }

  .memory-page-actions .icon {
    width: 12px;
    height: 12px;
  }

  .memory-page-number {
    bottom: 7px;
    font-size: 0.56rem;
  }

  .memory-page-decoration {
    bottom: 4px;
    font-size: 1rem;
  }

  .memory-blank-note {
    width: 84%;
    padding: 16px 9px;
  }

  .memory-blank-note strong {
    font-size: 0.76rem;
  }

  .memory-page-flower {
    right: 4%;
    bottom: 6%;
    transform: rotate(24deg) scale(0.72);
  }

  .memory-book-dots {
    min-height: 18px;
  }

  .memory-book-shell-empty {
    min-height: 0;
    padding: 8px 0 25px;
  }

  .memory-album-cover {
    min-height: min(500px, 60dvh);
    padding: 37px 24px 32px;
    box-shadow:
      9px 12px 0 #79584b,
      0 23px 48px rgba(50, 36, 31, 0.22);
  }

  .memory-cover-monogram {
    margin: 32px 0 39px;
  }

  .memory-album-cover h3 {
    font-size: 1.55rem;
  }
}

@media (max-width: 360px) {
  .memory-book {
    height: clamp(390px, 60dvh, 470px);
  }

  .memory-book-page {
    padding-right: 8px;
    padding-left: 8px;
  }

  .memory-book-page-left {
    padding-right: 13px;
  }

  .memory-book-page-right {
    padding-left: 13px;
  }

  .memory-book-page-right .memory-page-copy {
    padding-left: 8px;
  }

  .memory-page-copy p {
    -webkit-line-clamp: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .memory-book-turn-forward .memory-book-page-right,
  .memory-book-turn-backward .memory-book-page-left {
    animation: none !important;
  }
}

/* Mobile album: one generous, readable keepsake page at a time. */
@media (max-width: 600px) {
  #memories-view .collection-header {
    min-height: 58px;
    margin: 0;
    padding: 3px 8px 7px;
    align-items: center;
  }

  #memories-view .collection-header .eyebrow {
    display: none;
  }

  #memories-view .collection-header h2 {
    margin: 0;
    font-size: 1.65rem;
    line-height: 1;
  }

  #memories-view .collection-add-button {
    width: 44px;
    height: 44px;
  }

  #memory-list.memory-book-stage {
    width: 100%;
    padding: 0 0 20px !important;
  }

  .memory-book-shell-single {
    gap: 7px;
  }

  .memory-book-shell-single .memory-book-toolbar {
    min-height: 42px;
    padding: 0 14px;
    justify-content: center;
  }

  .memory-book-shell-single .memory-book-summary {
    display: none;
  }

  .memory-book-shell-single .memory-book-navigation {
    grid-template-columns: 38px minmax(74px, auto) 38px;
    gap: 12px;
  }

  .memory-book-shell-single .memory-book-nav {
    width: 38px;
    height: 38px;
  }

  .memory-book-shell-single .memory-book-page-label {
    font-size: 0.82rem;
  }

  .memory-book.memory-book-single {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: calc(100% - 18px);
    max-width: 430px;
    height: clamp(475px, 62dvh, 570px);
    margin: 0 auto;
    padding: 9px;
    border-radius: 9px;
    background:
      linear-gradient(90deg, #63483f, #966c59 3%, #715148 5%, #715148 95%, #966c59 97%, #63483f),
      #715148;
    box-shadow:
      0 20px 42px rgba(67, 45, 37, 0.18),
      0 5px 12px rgba(67, 45, 37, 0.1);
    touch-action: pan-y;
  }

  .memory-book-single::after {
    display: none;
  }

  .memory-book-single .memory-book-ribbon {
    top: auto;
    right: 25px;
    bottom: -12px;
    left: auto;
    width: 11px;
    height: 64px;
    opacity: 0.86;
  }

  .memory-book-single .memory-book-page-single {
    height: 100%;
    padding: 28px 22px 34px;
    border-radius: 6px;
    background:
      repeating-linear-gradient(0deg, rgba(111, 83, 66, 0.018) 0 1px, transparent 1px 29px),
      linear-gradient(145deg, rgba(255, 255, 255, 0.52), transparent 40%),
      #fffaf0;
    box-shadow:
      inset 0 0 32px rgba(111, 83, 61, 0.07),
      inset 0 -1px 0 rgba(116, 83, 64, 0.08);
  }

  .memory-book-single .memory-page-content {
    grid-template-rows: minmax(255px, 1fr) auto;
    gap: 19px;
  }

  .memory-book-single .memory-page-photo,
  .memory-book-single .memory-page-layout-landscape .memory-page-photo,
  .memory-book-single .memory-page-layout-postcard .memory-page-photo {
    align-self: stretch;
    width: min(100%, 330px);
    height: 100%;
    max-height: 350px;
    padding: 7px 7px 23px;
    transform: rotate(-0.7deg);
  }

  .memory-book-single .memory-page-layout-landscape .memory-page-photo {
    transform: rotate(0.8deg);
  }

  .memory-book-single .memory-page-layout-postcard .memory-page-photo {
    transform: rotate(-1.1deg);
  }

  .memory-book-single .memory-page-photo-button,
  .memory-book-single .memory-page-layout-portrait .memory-page-photo-button,
  .memory-book-single .memory-page-layout-landscape .memory-page-photo-button,
  .memory-book-single .memory-page-layout-postcard .memory-page-photo-button {
    height: 100%;
    aspect-ratio: auto;
    background: #f1ebe5;
  }

  .memory-book-single .memory-page-photo-button img {
    object-fit: contain;
  }

  .memory-book-single .memory-page-tape {
    top: -10px;
    width: 72px;
    height: 20px;
  }

  .memory-book-single .memory-page-photo-mark {
    right: 11px;
    bottom: 2px;
    font-size: 0.86rem;
  }

  .memory-book-single .memory-page-copy {
    padding: 0 32px 0 4px;
  }

  .memory-book-single .memory-page-meta {
    font-size: 0.63rem;
  }

  .memory-book-single .memory-page-copy h3 {
    margin: 7px 0 5px;
    font-size: 1.28rem;
    line-height: 1.2;
    -webkit-line-clamp: 2;
  }

  .memory-book-single .memory-page-copy p {
    padding: 0;
    font-size: 0.86rem;
    line-height: 1.45;
    -webkit-line-clamp: 3;
  }

  .memory-book-single .memory-page-author {
    right: 0;
    bottom: 1px;
    width: 28px;
    height: 28px;
    font-size: 0.68rem;
  }

  .memory-book-single .memory-page-actions {
    top: -16px;
    right: -11px;
    gap: 6px;
    opacity: 1;
  }

  .memory-book-single .memory-page-actions button {
    width: 34px;
    height: 34px;
  }

  .memory-book-single .memory-page-actions .icon {
    width: 14px;
    height: 14px;
  }

  .memory-book-single .memory-page-number {
    right: auto;
    bottom: 10px;
    left: 21px;
    font-size: 0.65rem;
  }

  .memory-book-single .memory-page-decoration {
    bottom: 6px;
    font-size: 1.08rem;
  }

  .memory-book-turn-forward .memory-book-page-single {
    animation: memory-single-forward 320ms cubic-bezier(0.2, 0.72, 0.24, 1);
  }

  .memory-book-turn-backward .memory-book-page-single {
    animation: memory-single-backward 320ms cubic-bezier(0.2, 0.72, 0.24, 1);
  }

  .memory-book-shell-single .memory-book-dots {
    display: none;
  }
}

@media (max-width: 360px) {
  .memory-book.memory-book-single {
    height: clamp(430px, 61dvh, 500px);
  }

  .memory-book-single .memory-book-page-single {
    padding-right: 17px;
    padding-left: 17px;
  }

  .memory-book-single .memory-page-content {
    grid-template-rows: minmax(215px, 1fr) auto;
    gap: 15px;
  }

  .memory-book-single .memory-page-copy h3 {
    font-size: 1.15rem;
  }

  .memory-book-single .memory-page-copy p {
    font-size: 0.8rem;
    -webkit-line-clamp: 2;
  }
}

@keyframes memory-single-forward {
  from {
    opacity: 0.35;
    transform: translateX(18px) rotateY(-4deg);
  }
  to {
    opacity: 1;
    transform: translateX(0) rotateY(0);
  }
}

@keyframes memory-single-backward {
  from {
    opacity: 0.35;
    transform: translateX(-18px) rotateY(4deg);
  }
  to {
    opacity: 1;
    transform: translateX(0) rotateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .memory-book-turn-forward .memory-book-page-single,
  .memory-book-turn-backward .memory-book-page-single {
    animation: none !important;
  }
}

/* The mobile album does not need a bookmark that looks cut off. */
@media (max-width: 600px) {
  .memory-book-single .memory-book-ribbon {
    display: none;
  }
}

/* Love-letter desk: envelopes feel collected, not tiled. */
#letters-view .collection-header {
  width: min(100%, 1040px);
  margin-right: auto;
  margin-left: auto;
}

#letters-view .collection-layout {
  gap: 14px;
}

#letter-list.letter-grid {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(3, minmax(210px, 1fr));
  gap: 44px 24px;
  width: min(100%, 1040px);
  margin: 0 auto;
  padding: 62px 34px 54px;
  overflow: hidden;
  border: 1px solid rgba(132, 87, 70, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 0 8%, rgba(195, 94, 101, 0.055) 8% calc(8% + 1px), transparent calc(8% + 1px)),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(116, 89, 71, 0.035) 31px 32px),
    radial-gradient(circle at 10% 12%, rgba(226, 168, 174, 0.13), transparent 22%),
    radial-gradient(circle at 90% 88%, rgba(128, 182, 167, 0.13), transparent 24%),
    #fffaf1;
  box-shadow:
    0 24px 58px rgba(71, 49, 39, 0.1),
    inset 0 0 42px rgba(126, 88, 67, 0.045);
}

#letter-list.letter-grid::before {
  position: absolute;
  top: 20px;
  left: 30px;
  z-index: -1;
  color: rgba(128, 82, 72, 0.52);
  content: "Kirjad, mis jäävad";
  font-family: "Segoe Print", "Bradley Hand ITC", "Apple Chancery", cursive;
  font-size: 0.88rem;
  transform: rotate(-1deg);
}

#letter-list.letter-grid::after {
  position: absolute;
  right: 27px;
  bottom: 20px;
  z-index: -1;
  color: rgba(191, 86, 102, 0.18);
  content: "❦  ♥";
  font-family: Georgia, serif;
  font-size: 2.1rem;
  transform: rotate(-8deg);
}

#letter-list .letter-card.envelope-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 300px;
  padding: 10px 12px 13px;
  border: 0;
  border-radius: 6px;
  background: rgba(255, 253, 248, 0.63);
  box-shadow:
    0 13px 30px rgba(76, 50, 40, 0.08),
    inset 0 0 0 1px rgba(146, 96, 75, 0.07);
  transform: translateY(0) rotate(-1.4deg);
  transition: transform 220ms ease, box-shadow 220ms ease;
}

#letter-list .letter-card.envelope-card:nth-child(4n + 2) {
  transform: translateY(20px) rotate(1.6deg);
}

#letter-list .letter-card.envelope-card:nth-child(4n + 3) {
  transform: translateY(6px) rotate(-0.5deg);
}

#letter-list .letter-card.envelope-card:nth-child(4n + 4) {
  transform: translateY(24px) rotate(1deg);
}

#letter-list .letter-card.envelope-card:not(.open):hover,
#letter-list .letter-card.envelope-card:not(.open):focus-within {
  z-index: 4;
  box-shadow:
    0 22px 42px rgba(76, 50, 40, 0.14),
    inset 0 0 0 1px rgba(190, 87, 99, 0.12);
  transform: translateY(-6px) rotate(0);
}

#letter-list .letter-card:not(.open) .letter-envelope-scene {
  height: 170px;
  overflow: visible;
}

#letter-list .letter-card:not(.open) .letter-envelope {
  width: 260px;
  height: 184px;
  margin-top: 4px;
  transform: scale(0.82);
}

#letter-list .letter-card:not(.open) .letter-card-caption {
  min-height: 58px;
  padding: 5px 7px 4px;
}

#letter-list .letter-card:not(.open) .letter-card-caption strong {
  color: #5b3d3e;
  font-family: "Segoe Print", "Bradley Hand ITC", "Apple Chancery", cursive;
  font-size: 0.88rem;
}

#letter-list .letter-card:not(.open) .letter-card-caption span {
  color: #92746b;
  font-size: 0.66rem;
}

#letter-list .letter-card.open {
  z-index: 6;
  grid-column: 1 / -1;
  width: min(100%, 760px);
  max-width: 760px;
  justify-self: center;
  transform: none;
}

#letter-list .letter-card.open .letter-actions {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 16;
  display: flex;
  gap: 6px;
}

#letter-list .letter-card.open .letter-card-caption {
  position: static !important;
}

#letter-list .letter-card.open .letter-actions button {
  width: 34px !important;
  min-width: 34px !important;
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 !important;
  border: 1px solid rgba(135, 83, 72, 0.12) !important;
  border-radius: 50%;
  background: rgba(255, 252, 247, 0.92) !important;
  box-shadow: 0 7px 18px rgba(69, 46, 37, 0.1);
}

#letter-list .empty-state {
  grid-column: 1 / -1;
  min-height: 360px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

@media (max-width: 840px) {
  #letters-view .collection-header {
    margin-bottom: 4px;
    padding-right: 8px;
    padding-left: 8px;
  }

  #letters-view .collection-header .eyebrow {
    display: none;
  }

  #letters-view .collection-header h2 {
    font-size: 1.65rem;
  }

  #letter-list.letter-grid {
    display: flex !important;
    gap: 14px !important;
    align-items: stretch;
    justify-content: flex-start;
    width: 100%;
    padding: 48px max(24px, calc((100vw - min(82vw, 330px)) / 2)) 38px !important;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    scroll-padding-inline: max(24px, calc((100vw - min(82vw, 330px)) / 2));
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  #letter-list.letter-grid::-webkit-scrollbar {
    display: none;
  }

  #letter-list.letter-grid::before {
    top: 15px;
    left: 22px;
  }

  #letter-list.letter-grid::after {
    right: 15px;
    bottom: 11px;
  }

  #letter-list .letter-card.envelope-card,
  #letter-list .letter-card.envelope-card:nth-child(n) {
    flex: 0 0 min(82vw, 330px);
    width: min(82vw, 330px);
    max-width: none;
    margin: 0;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    transform: rotate(-0.8deg);
  }

  #letter-list .letter-card.envelope-card:nth-child(even) {
    transform: rotate(0.8deg);
  }

  #letter-list .letter-card.open,
  #letter-list .letter-card.open:nth-child(n) {
    flex-basis: calc(100vw - 28px);
    width: calc(100vw - 28px);
    transform: none;
  }

  #letter-list .letter-card:not(.open) .letter-envelope {
    width: 270px;
    transform: scale(0.84);
  }

  #letter-list .empty-state {
    flex: 0 0 calc(100vw - 40px);
  }
}

/* Time-of-day ambience. */
body {
  isolation: isolate;
  transition: background 800ms ease, color 500ms ease;
}

.ambient-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.app-shell {
  position: relative;
  z-index: 1;
}

.app-shell > .sidebar,
.app-shell > .workspace,
.app-shell > .today-panel {
  position: relative;
  z-index: 1;
}

.ambient-scene > span {
  position: absolute;
  opacity: 0;
  transition: opacity 900ms ease, transform 1200ms ease;
}

.ambient-sun {
  top: -95px;
  right: 8%;
  width: 290px;
  height: 290px;
  border-radius: 50%;
  background: rgba(255, 224, 157, 0.3);
  box-shadow: 0 0 100px 45px rgba(255, 218, 150, 0.2);
  filter: blur(3px);
}

.ambient-moon {
  top: 7vh;
  right: 24vw;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: #f4c891;
  box-shadow: 0 0 48px 12px rgba(247, 196, 136, 0.2);
}

.ambient-moon::after {
  position: absolute;
  top: -10px;
  left: 31px;
  width: 102px;
  height: 102px;
  border-radius: 50%;
  background: #243b43;
  content: "";
}

.ambient-star {
  color: rgba(255, 226, 170, 0.86);
  font-size: 1rem;
  animation: ambient-twinkle 3.8s ease-in-out infinite;
}

.ambient-star-one {
  top: 13%;
  left: 13%;
}

.ambient-star-two {
  top: 26%;
  right: 23%;
  animation-delay: 1.1s;
}

.ambient-star-three {
  top: 10%;
  left: 55%;
  animation-delay: 2.2s;
}

.ambient-heart {
  color: rgba(236, 138, 156, 0.2);
  font-family: Georgia, serif;
  animation: ambient-heart-float 8s ease-in-out infinite;
}

.ambient-heart-one {
  top: 32%;
  left: 3%;
  font-size: 1.4rem;
}

.ambient-heart-two {
  right: 3%;
  bottom: 21%;
  font-size: 1.05rem;
  animation-delay: 2.8s;
}

.ambient-candle {
  bottom: -16px;
  width: 34px;
  height: 96px;
  border-radius: 9px 9px 2px 2px;
  background:
    linear-gradient(90deg, rgba(139, 77, 70, 0.12), transparent 24% 72%, rgba(139, 77, 70, 0.12)),
    #f3d4b4;
  box-shadow: 0 0 50px 20px rgba(243, 155, 89, 0.16);
}

.ambient-candle::before {
  position: absolute;
  top: -27px;
  left: 10px;
  width: 14px;
  height: 31px;
  border-radius: 50% 50% 46% 46%;
  background: linear-gradient(#fff4bc, #f39a59 72%, #c95e4e);
  box-shadow: 0 0 30px 12px rgba(245, 168, 94, 0.3);
  content: "";
  transform-origin: center bottom;
  animation: candle-flicker 1.9s ease-in-out infinite alternate;
}

.ambient-candle::after {
  position: absolute;
  top: -2px;
  left: 15px;
  width: 4px;
  height: 8px;
  border-radius: 50%;
  background: #6d493e;
  content: "";
}

.ambient-candle-one {
  left: 3vw;
}

.ambient-candle-two {
  right: 3vw;
  height: 72px;
}

body.theme-day:not(.is-locked) {
  background:
    linear-gradient(112deg, rgba(225, 244, 237, 0.94), transparent 38%),
    linear-gradient(292deg, rgba(255, 226, 229, 0.82), transparent 40%),
    linear-gradient(180deg, #fffaf6, #f8f2eb) !important;
}

body.theme-day .ambient-sun {
  opacity: 1;
  animation: ambient-sun-breathe 9s ease-in-out infinite;
}

body.theme-day .ambient-heart {
  opacity: 0.65;
}

body.theme-evening:not(.is-locked) {
  background:
    radial-gradient(circle at 15% 5%, rgba(94, 136, 131, 0.42), transparent 31%),
    radial-gradient(circle at 85% 8%, rgba(122, 76, 107, 0.42), transparent 34%),
    linear-gradient(145deg, #233f42, #34263e 58%, #5d3545) !important;
}

body.theme-night:not(.is-locked) {
  background:
    radial-gradient(circle at 12% 4%, rgba(47, 101, 99, 0.34), transparent 28%),
    radial-gradient(circle at 89% 7%, rgba(88, 53, 93, 0.44), transparent 31%),
    linear-gradient(145deg, #142e32, #181426 62%, #3c2232) !important;
}

body.theme-evening .ambient-moon,
body.theme-night .ambient-moon,
body.theme-evening .ambient-star,
body.theme-night .ambient-star,
body.theme-evening .ambient-candle,
body.theme-night .ambient-candle {
  opacity: 1;
}

body.theme-evening .ambient-heart,
body.theme-night .ambient-heart {
  opacity: 0.72;
}

body.theme-night .ambient-moon {
  opacity: 0.78;
  transform: scale(0.92);
}

body.theme-evening:not(.is-locked) .sidebar,
body.theme-evening:not(.is-locked) .today-panel,
body.theme-night:not(.is-locked) .sidebar,
body.theme-night:not(.is-locked) .today-panel {
  border-color: rgba(255, 230, 216, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 250, 242, 0.94), rgba(247, 234, 226, 0.9));
  box-shadow:
    0 28px 70px rgba(8, 15, 19, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

body.theme-evening:not(.is-locked) .widget,
body.theme-evening:not(.is-locked) .pulse-widget,
body.theme-night:not(.is-locked) .widget,
body.theme-night:not(.is-locked) .pulse-widget {
  box-shadow:
    0 20px 48px rgba(10, 14, 18, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

body.theme-evening:not(.is-locked) .mobile-wordmark strong,
body.theme-night:not(.is-locked) .mobile-wordmark strong {
  color: #fff3ea;
  text-shadow: 0 2px 18px rgba(13, 10, 18, 0.28);
}

body.theme-evening:not(.is-locked) .top-actions > .icon-button,
body.theme-night:not(.is-locked) .top-actions > .icon-button {
  border-color: rgba(255, 239, 226, 0.3);
  background: rgba(255, 249, 241, 0.88);
  box-shadow: 0 10px 24px rgba(12, 12, 18, 0.18);
}

body.theme-evening:not(.is-locked) #letters-view .collection-header h2,
body.theme-evening:not(.is-locked) #memories-view .collection-header h2,
body.theme-night:not(.is-locked) #letters-view .collection-header h2,
body.theme-night:not(.is-locked) #memories-view .collection-header h2 {
  color: #fff5ec;
  text-shadow: 0 2px 20px rgba(13, 10, 18, 0.28);
}

body.theme-evening:not(.is-locked) #letters-view .collection-header .eyebrow,
body.theme-evening:not(.is-locked) #memories-view .collection-header .eyebrow,
body.theme-night:not(.is-locked) #letters-view .collection-header .eyebrow,
body.theme-night:not(.is-locked) #memories-view .collection-header .eyebrow {
  color: #efb0b9;
}

@media (max-width: 840px) {
  body.theme-evening:not(.is-locked) .main-nav,
  body.theme-night:not(.is-locked) .main-nav {
    border-top-color: rgba(255, 232, 218, 0.18);
    background: rgba(255, 249, 241, 0.95);
    box-shadow: 0 -12px 34px rgba(10, 11, 17, 0.2);
  }

  body.theme-evening .ambient-moon,
  body.theme-night .ambient-moon {
    top: 74px;
    right: 92px;
    left: auto;
    width: 48px;
    height: 48px;
    opacity: 0.66;
  }

  body.theme-evening .ambient-moon::after,
  body.theme-night .ambient-moon::after {
    top: -5px;
    left: 15px;
    width: 48px;
    height: 48px;
  }

  body.theme-evening .ambient-candle,
  body.theme-night .ambient-candle {
    display: none;
  }

  body.theme-evening:not(.is-locked) {
    background:
      radial-gradient(circle at 50% 100%, rgba(244, 153, 97, 0.23), transparent 34%),
      radial-gradient(circle at 12% 4%, rgba(71, 129, 124, 0.42), transparent 31%),
      radial-gradient(circle at 92% 8%, rgba(119, 73, 104, 0.42), transparent 34%),
      linear-gradient(145deg, #213b3f, #34263e 58%, #5b3444) !important;
  }

  body.theme-night:not(.is-locked) {
    background:
      radial-gradient(circle at 50% 100%, rgba(224, 123, 81, 0.16), transparent 32%),
      radial-gradient(circle at 12% 4%, rgba(47, 101, 99, 0.34), transparent 28%),
      radial-gradient(circle at 89% 7%, rgba(88, 53, 93, 0.44), transparent 31%),
      linear-gradient(145deg, #142e32, #181426 62%, #3c2232) !important;
  }

  body.theme-evening:not(.is-locked) #letter-list.letter-grid,
  body.theme-night:not(.is-locked) #letter-list.letter-grid {
    box-shadow: 0 22px 58px rgba(8, 12, 17, 0.25);
  }
}

@keyframes ambient-twinkle {
  0%,
  100% {
    opacity: 0.32;
    transform: scale(0.76) rotate(0);
  }
  50% {
    opacity: 1;
    transform: scale(1.12) rotate(12deg);
  }
}

/* Mobile evening contrast, cleaner dock and a visible letter collection. */
@media (max-width: 840px) {
  body.theme-evening:not(.is-locked) .mobile-wordmark strong,
  body.theme-night:not(.is-locked) .mobile-wordmark strong,
  body.theme-evening:not(.is-locked) #letters-view .collection-header h2,
  body.theme-evening:not(.is-locked) #memories-view .collection-header h2,
  body.theme-night:not(.is-locked) #letters-view .collection-header h2,
  body.theme-night:not(.is-locked) #memories-view .collection-header h2 {
    color: #70445a;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.72);
  }

  body.theme-evening:not(.is-locked) .main-nav,
  body.theme-night:not(.is-locked) .main-nav {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }
}

@media (max-width: 600px) {
  #letter-list.letter-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 24px 8px !important;
    align-items: start;
    width: 100%;
    padding: 50px 10px 46px !important;
    overflow: visible;
    border-right: 0;
    border-left: 0;
    scroll-snap-type: none;
  }

  #letter-list .letter-card.envelope-card,
  #letter-list .letter-card.envelope-card:nth-child(n) {
    width: 100%;
    min-width: 0;
    max-width: none;
    margin: 0;
    padding: 8px 7px 10px !important;
    border-radius: 5px;
    scroll-snap-align: none;
    box-shadow:
      0 12px 24px rgba(76, 50, 40, 0.1),
      inset 0 0 0 1px rgba(146, 96, 75, 0.07);
    transform: translateY(2px) rotate(-2deg);
  }

  #letter-list .letter-card.envelope-card:nth-child(even) {
    z-index: 2;
    transform: translateY(26px) rotate(2.2deg);
  }

  #letter-list .letter-card.envelope-card:nth-child(4n + 3) {
    transform: translateY(8px) rotate(1.3deg);
  }

  #letter-list .letter-card.envelope-card:nth-child(4n + 4) {
    transform: translateY(30px) rotate(-1.5deg);
  }

  #letter-list .letter-card:not(.open) .letter-envelope-scene {
    height: 116px;
    overflow: hidden;
    border-radius: 4px;
  }

  #letter-list .letter-card:not(.open) .letter-envelope {
    width: 260px;
    height: 184px;
    margin: 3px 0 0 calc(50% - 130px);
    transform: scale(0.57);
    transform-origin: top center;
  }

  #letter-list .letter-card:not(.open) .letter-card-caption {
    min-height: 62px;
    padding: 5px 4px 2px;
  }

  #letter-list .letter-card:not(.open) .letter-card-caption strong {
    font-size: 0.76rem;
    line-height: 1.25;
  }

  #letter-list .letter-card:not(.open) .letter-card-caption span {
    margin-top: 3px;
    font-size: 0.58rem;
    line-height: 1.25;
  }

  #letter-list .letter-card:not(.open) .letter-actions {
    top: 6px;
    right: 5px;
    gap: 3px;
  }

  #letter-list .letter-card:not(.open) .letter-actions button {
    width: 27px !important;
    min-width: 27px !important;
    height: 27px !important;
    min-height: 27px !important;
    border-radius: 50% !important;
    backdrop-filter: blur(7px);
  }

  #letter-list .letter-card:not(.open) .letter-actions .icon {
    width: 14px;
    height: 14px;
  }

  #letter-list .letter-card.open,
  #letter-list .letter-card.open:nth-child(n) {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
    transform: none;
  }

  #letter-list .empty-state {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@keyframes ambient-heart-float {
  0%,
  100% {
    transform: translateY(0) rotate(-8deg);
  }
  50% {
    transform: translateY(-18px) rotate(7deg);
  }
}

@keyframes candle-flicker {
  0% {
    transform: rotate(-3deg) scaleY(0.94);
  }
  100% {
    transform: rotate(4deg) scaleY(1.06);
  }
}

@keyframes ambient-sun-breathe {
  0%,
  100% {
    transform: scale(0.96);
  }
  50% {
    transform: scale(1.06);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ambient-scene *,
  .ambient-scene *::before {
    animation: none !important;
  }
}

/* Mobile dusk must be visible above the otherwise opaque app canvas. */
@media (max-width: 840px) {
  body.theme-evening:not(.is-locked):not(.chat-active) .app-shell,
  body.theme-night:not(.is-locked):not(.chat-active) .app-shell {
    background:
      radial-gradient(circle at 16% 8%, rgba(112, 174, 162, 0.2), transparent 24%),
      radial-gradient(circle at 88% 10%, rgba(225, 142, 157, 0.16), transparent 27%),
      linear-gradient(
        180deg,
        rgba(23, 57, 61, 0.99) 0,
        rgba(55, 43, 67, 0.98) 145px,
        rgba(111, 62, 83, 0.91) 232px,
        rgba(246, 231, 225, 0.98) 355px,
        rgba(251, 245, 238, 0.99) 520px
      ) !important;
  }

  body.theme-night:not(.is-locked):not(.chat-active) .app-shell {
    background:
      radial-gradient(circle at 16% 8%, rgba(69, 132, 128, 0.18), transparent 23%),
      radial-gradient(circle at 88% 9%, rgba(150, 91, 139, 0.18), transparent 25%),
      linear-gradient(
        180deg,
        rgba(10, 37, 43, 0.995) 0,
        rgba(31, 28, 52, 0.99) 155px,
        rgba(68, 39, 62, 0.95) 238px,
        rgba(231, 216, 216, 0.98) 365px,
        rgba(248, 241, 234, 0.99) 530px
      ) !important;
  }

  body.theme-evening:not(.is-locked):not(.chat-active) .ambient-scene,
  body.theme-night:not(.is-locked):not(.chat-active) .ambient-scene {
    z-index: 0;
    height: 270px;
  }

  body.theme-evening:not(.is-locked):not(.chat-active) .ambient-moon,
  body.theme-night:not(.is-locked):not(.chat-active) .ambient-moon {
    top: calc(82px + env(safe-area-inset-top));
    right: auto;
    left: calc(50% - 24px);
    width: 48px;
    height: 48px;
    opacity: 0.96;
    box-shadow:
      0 0 34px 9px rgba(247, 196, 136, 0.24),
      0 0 80px 24px rgba(238, 151, 127, 0.08);
    animation: mobile-moon-drift 7s ease-in-out infinite;
  }

  body.theme-evening:not(.is-locked):not(.chat-active) .ambient-moon::after,
  body.theme-night:not(.is-locked):not(.chat-active) .ambient-moon::after {
    top: -6px;
    left: 15px;
    width: 48px;
    height: 48px;
    background: #372b42;
  }

  body.theme-night:not(.is-locked):not(.chat-active) .ambient-moon::after {
    background: #1f2035;
  }

  body.theme-evening:not(.is-locked):not(.chat-active) .ambient-star,
  body.theme-night:not(.is-locked):not(.chat-active) .ambient-star {
    color: rgba(255, 227, 178, 0.94);
    text-shadow: 0 0 12px rgba(255, 211, 147, 0.54);
  }

  body.theme-evening:not(.is-locked):not(.chat-active) .ambient-star-one,
  body.theme-night:not(.is-locked):not(.chat-active) .ambient-star-one {
    top: 72px;
    left: 17%;
  }

  body.theme-evening:not(.is-locked):not(.chat-active) .ambient-star-two,
  body.theme-night:not(.is-locked):not(.chat-active) .ambient-star-two {
    top: 155px;
    right: 22%;
  }

  body.theme-evening:not(.is-locked):not(.chat-active) .ambient-star-three,
  body.theme-night:not(.is-locked):not(.chat-active) .ambient-star-three {
    top: 91px;
    left: 76%;
  }

  body.theme-evening:not(.is-locked):not(.chat-active) .mobile-wordmark strong,
  body.theme-night:not(.is-locked):not(.chat-active) .mobile-wordmark strong,
  body.theme-evening:not(.is-locked):not(.chat-active) #letters-view .collection-header h2,
  body.theme-evening:not(.is-locked):not(.chat-active) #memories-view .collection-header h2,
  body.theme-night:not(.is-locked):not(.chat-active) #letters-view .collection-header h2,
  body.theme-night:not(.is-locked):not(.chat-active) #memories-view .collection-header h2 {
    color: #fff4ea;
    text-shadow: 0 2px 18px rgba(11, 15, 21, 0.34);
  }

  body.theme-evening:not(.is-locked):not(.chat-active) .topbar,
  body.theme-night:not(.is-locked):not(.chat-active) .topbar {
    z-index: 3;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
  }

  body.theme-evening:not(.is-locked):not(.chat-active) #letters-view .collection-header,
  body.theme-evening:not(.is-locked):not(.chat-active) #memories-view .collection-header,
  body.theme-night:not(.is-locked):not(.chat-active) #letters-view .collection-header,
  body.theme-night:not(.is-locked):not(.chat-active) #memories-view .collection-header {
    position: relative;
    z-index: 3;
  }

  body.theme-evening:not(.is-locked):not(.chat-active) .mobile-wordmark .brand-mark,
  body.theme-night:not(.is-locked):not(.chat-active) .mobile-wordmark .brand-mark {
    border: 1px solid rgba(255, 236, 222, 0.34);
    box-shadow:
      0 8px 24px rgba(4, 13, 18, 0.28),
      0 0 0 4px rgba(255, 226, 211, 0.06);
  }

  body.theme-evening:not(.is-locked):not(.chat-active) .collection-add-button,
  body.theme-night:not(.is-locked):not(.chat-active) .collection-add-button {
    border-color: rgba(255, 235, 222, 0.4);
    background: rgba(255, 248, 240, 0.92);
    box-shadow:
      0 12px 28px rgba(14, 17, 24, 0.25),
      inset 0 1px 0 rgba(255, 255, 255, 0.82);
  }

  body.theme-evening:not(.is-locked):not(.chat-active) .top-actions > .icon-button,
  body.theme-night:not(.is-locked):not(.chat-active) .top-actions > .icon-button {
    border-color: rgba(255, 235, 222, 0.4);
    background: rgba(255, 248, 240, 0.92);
    color: #69475a;
  }
}

@keyframes mobile-moon-drift {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-5px) rotate(2deg);
  }
}
