:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #241f1a;
  --muted: #786f65;
  --line: #e7ddd0;
  --paper: #f7f3ea;
  --surface: #fffdf8;
  --accent: #e8663c;
  --leaf: #497a64;
  --sky: #7aa7b6;
  --memory: #6d5d8f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 16%, rgba(73, 122, 100, 0.16), transparent 30%),
    radial-gradient(circle at 86% 20%, rgba(122, 167, 182, 0.18), transparent 28%),
    linear-gradient(135deg, #fbfbf7 0%, #f7f3ea 48%, #eef5f1 100%);
  display: grid;
  place-items: center;
  padding: 20px;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

img {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
}

.phone-shell {
  width: min(100%, 430px);
  min-height: min(860px, calc(100vh - 40px));
  border: 10px solid #241f1a;
  border-radius: 34px;
  background: #241f1a;
  box-shadow: 0 28px 70px rgba(36, 31, 26, 0.22);
  overflow: hidden;
}

.app-screen {
  position: relative;
  height: min(840px, calc(100vh - 60px));
  min-height: 680px;
  overflow: hidden;
  background: var(--paper);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
}

.auth-screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(247, 243, 234, 0.98);
}

.auth-screen.hidden {
  display: none;
}

.auth-card {
  width: 100%;
  display: grid;
  gap: 14px;
  padding: 24px;
  border-radius: 22px;
  background: #fffdf8;
  border: 1px solid var(--line);
  box-shadow: 0 18px 44px rgba(36, 31, 26, 0.14);
}

.auth-logo {
  width: 68px;
  height: 68px;
  border-radius: 20px;
}

.auth-card h2 {
  margin: 0;
  font-size: 26px;
}

.auth-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 11px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.auth-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

.auth-message {
  min-height: 18px;
  margin: 0;
  color: var(--leaf);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.top-bar {
  min-height: 74px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  background: rgba(247, 243, 234, 0.95);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(231, 221, 208, 0.9);
  z-index: 2;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.app-logo {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(232, 102, 60, 0.16);
}

.eyebrow {
  display: block;
  color: var(--leaf);
  font-size: 12px;
  font-weight: 850;
}

.top-bar h1 {
  margin: 2px 0 0;
  font-size: 28px;
  letter-spacing: 0;
  font-weight: 900;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--line);
  font-weight: 900;
}

.daily-strip {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 10px 14px;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
}

.daily-strip::-webkit-scrollbar,
.topic-filter::-webkit-scrollbar {
  display: none;
}

.daily-card {
  width: 188px;
  flex: 0 0 188px;
  display: flex;
  align-items: center;
  text-align: left;
  gap: 10px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.daily-card:focus-visible,
.text-button:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.edit-profile:focus-visible,
.support-button:focus-visible {
  outline: 3px solid rgba(232, 102, 60, 0.35);
  outline-offset: 2px;
}

.daily-card img {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  object-fit: cover;
}

.daily-card div {
  min-width: 0;
}

.daily-card strong,
.daily-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daily-card strong {
  font-size: 14px;
}

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

.content-view {
  display: none;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 14px 88px;
}

.content-view.active {
  display: block;
}

.install-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  padding: 13px 42px 13px 14px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(36, 31, 26, 0.08);
}

.install-card.hidden {
  display: none;
}

.install-card strong {
  display: block;
  font-size: 14px;
}

.install-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.install-button {
  min-width: 56px;
  height: 34px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.install-close {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #f1e7dc;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-title h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: 0;
}

.text-button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: #fff;
  color: var(--leaf);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 850;
}

.topic-filter {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 10px;
  scrollbar-width: none;
}

.filter {
  flex: 0 0 auto;
  padding: 8px 13px;
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 800;
}

.filter.active {
  color: #fff;
  background: var(--leaf);
  border-color: var(--leaf);
}

.conversation-card,
.meet-card,
.profile-notes,
.memory-wall article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 15px;
  box-shadow: 0 10px 24px rgba(36, 31, 26, 0.06);
}

.conversation-card {
  overflow: hidden;
  margin-bottom: 12px;
  padding: 0;
  cursor: pointer;
}

.conversation-card[hidden] {
  display: none;
}

.conversation-card.highlight {
  border-color: rgba(232, 102, 60, 0.34);
  background: #fff9f2;
}

.lounge-photo {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 8.4;
  object-fit: cover;
}

.card-body {
  padding: 12px 14px 0;
}

.answer-preview {
  display: grid;
  gap: 4px;
  margin-top: 11px;
  padding: 10px 11px;
  border-radius: 12px;
  background: #f4efe6;
}

.answer-preview strong {
  color: var(--leaf);
  font-size: 12px;
}

.answer-preview span {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.walk-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}

.walk-pills span {
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--leaf);
  background: #edf3ef;
  font-size: 12px;
  font-weight: 850;
}

.conversation-head,
.conversation-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.topic-tag {
  padding: 5px 9px;
  border-radius: 999px;
  color: #fff;
  background: var(--sky);
  font-weight: 850;
}

.daily-tag {
  background: var(--accent);
}

.conversation-card h3,
.meet-card h3,
.memory-hero h3,
.profile-notes h3 {
  margin: 10px 0 6px;
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: 0;
}

.conversation-card p,
.meet-card p,
.memory-hero p,
.profile-notes p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.conversation-meta {
  margin-top: 11px;
  padding: 0 14px 12px;
}

.support-button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--ink);
  background: #f2eadf;
  font-size: 13px;
  font-weight: 850;
}

.support-button.active {
  color: #fff;
  background: var(--accent);
}

.map-panel {
  position: relative;
  min-height: 180px;
  overflow: hidden;
  display: grid;
  align-content: end;
  gap: 6px;
  padding: 18px;
  border-radius: 18px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(36, 31, 26, 0.2), rgba(36, 31, 26, 0.18)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.12) 0 2px, transparent 2px 24px),
    linear-gradient(135deg, var(--leaf), var(--sky));
}

.map-panel strong {
  font-size: 18px;
}

.map-panel p {
  max-width: 280px;
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  line-height: 1.45;
}

.pin {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50% 50% 50% 4px;
  background: #fff;
  transform: rotate(-45deg);
  box-shadow: 0 8px 18px rgba(36, 31, 26, 0.18);
}

.pin-one {
  top: 36px;
  left: 72px;
}

.pin-two {
  top: 62px;
  right: 86px;
}

.pin-three {
  top: 92px;
  left: 190px;
}

.meet-card {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.meet-card time {
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.primary-button,
.secondary-button,
.edit-profile {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  font-weight: 900;
}

.primary-button,
.edit-profile {
  color: #fff;
  background: var(--ink);
}

.secondary-button {
  color: var(--leaf);
  background: #ecf3ef;
}

.upload-panel {
  min-height: 300px;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 12px;
  background: var(--surface);
  border: 1px dashed #cdbdab;
  border-radius: 18px;
  padding: 28px;
}

.upload-art {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border-radius: 26px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--leaf));
  font-size: 42px;
  font-weight: 900;
}

.upload-panel h2 {
  margin: 0;
  font-size: 22px;
}

.upload-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.care-checklist {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.care-checklist label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-weight: 750;
}

.stored-journal-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.saved-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.saved-card img,
.stored-memory img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
}

.saved-card strong,
.stored-memory strong {
  display: block;
  font-size: 14px;
}

.saved-card p,
.saved-card span,
.stored-memory p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.memory-hero {
  overflow: hidden;
  cursor: pointer;
  background: #fff;
  border: 1px solid #ddd4e8;
  border-radius: 18px;
  box-shadow: 0 12px 26px rgba(109, 93, 143, 0.12);
}

.memory-hero img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.memory-hero div {
  padding: 15px;
}

.memory-hero span {
  color: var(--memory);
  font-size: 13px;
  font-weight: 900;
}

.memory-wall {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.memory-wall article {
  border-color: #ddd4e8;
}

.memory-wall .stored-memory {
  display: grid;
  grid-template-columns: 64px 1fr;
  column-gap: 10px;
  align-items: center;
}

.stored-memory p {
  grid-column: 2;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-head img {
  width: 86px;
  height: 86px;
  border-radius: 24px;
  object-fit: cover;
  border: 4px solid #fff;
  box-shadow: 0 12px 28px rgba(36, 31, 26, 0.12);
}

.profile-head h2 {
  margin: 0;
  font-size: 22px;
}

.profile-head p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 18px 0 12px;
  text-align: center;
}

.profile-stats span {
  display: grid;
  gap: 2px;
  padding: 10px 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
}

.profile-stats strong {
  color: var(--ink);
  font-size: 17px;
}

.profile-notes {
  margin-top: 12px;
}

.logout-button {
  margin-top: 8px;
}

.bottom-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 74px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  background: rgba(255, 253, 248, 0.96);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  z-index: 3;
}

.nav-item {
  min-width: 0;
  height: 58px;
  display: grid;
  place-items: center;
  gap: 2px;
  background: transparent;
  color: var(--muted);
  font-size: 21px;
  font-weight: 900;
}

.nav-item span {
  font-size: 10px;
  font-weight: 800;
}

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

.nav-item.add {
  color: var(--leaf);
}

.detail-sheet {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

.detail-sheet.open {
  pointer-events: auto;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(36, 31, 26, 0);
  transition: background 180ms ease;
}

.detail-sheet.open .sheet-backdrop {
  background: rgba(36, 31, 26, 0.34);
}

.sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 78%;
  overflow-y: auto;
  padding: 8px 16px 22px;
  border-radius: 24px 24px 0 0;
  background: #fffdf8;
  border-top: 1px solid var(--line);
  box-shadow: 0 -18px 50px rgba(36, 31, 26, 0.22);
  transform: translateY(102%);
  transition: transform 220ms ease;
}

.detail-sheet.open .sheet-panel {
  transform: translateY(0);
}

.sheet-grip {
  width: 42px;
  height: 5px;
  margin: 4px auto 14px;
  border-radius: 999px;
  background: #d8cec1;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.sheet-kicker {
  color: var(--leaf);
  font-size: 12px;
  font-weight: 900;
}

.sheet-head h2 {
  margin: 3px 0 0;
  font-size: 21px;
  line-height: 1.25;
}

.sheet-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--muted);
  background: #f3ece2;
  font-size: 22px;
  font-weight: 850;
}

.sheet-content {
  display: grid;
  gap: 12px;
}

.sheet-photo {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 16px;
}

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

.detail-stat,
.mini-card,
.form-card {
  background: #f7f2ea;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px;
}

.detail-stat {
  display: grid;
  gap: 3px;
  text-align: center;
}

.detail-stat strong {
  font-size: 17px;
}

.detail-stat span,
.mini-card span,
.form-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.mini-card {
  display: grid;
  gap: 5px;
}

.mini-card strong,
.form-card strong {
  font-size: 14px;
}

.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sheet-actions .primary-button,
.sheet-actions .secondary-button {
  min-height: 42px;
}

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

.form-card {
  display: grid;
  gap: 6px;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: 16px;
  background: #f1e9dd;
}

.mode-option {
  display: grid;
  gap: 3px;
  min-height: 62px;
  padding: 10px;
  text-align: center;
  border-radius: 12px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-weight: 800;
}

.mode-option strong {
  color: var(--ink);
  font-size: 14px;
}

.mode-option.active {
  border-color: rgba(232, 102, 60, 0.28);
  background: #fffdf8;
  box-shadow: 0 6px 16px rgba(36, 31, 26, 0.08);
}

.mode-panel {
  display: none;
  gap: 9px;
}

.mode-panel.active {
  display: grid;
}

.upload-card,
.profile-photo-editor {
  display: grid;
  gap: 11px;
  padding: 11px;
  border-radius: 16px;
  background: #f7f2ea;
  border: 1px solid var(--line);
}

.upload-preview {
  width: 100%;
  aspect-ratio: 16 / 8.5;
  object-fit: cover;
  border-radius: 13px;
  background: #fff;
}

.upload-copy {
  display: grid;
  gap: 5px;
}

.upload-copy strong,
.profile-photo-editor strong {
  font-size: 14px;
}

.upload-copy span,
.profile-photo-editor span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.photo-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.photo-action {
  min-height: 38px;
  border-radius: 12px;
  background: #fff;
  color: var(--leaf);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 850;
}

.photo-action.primary-photo {
  color: #fff;
  background: var(--leaf);
  border-color: var(--leaf);
}

.photo-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.photo-picker.compact {
  grid-template-columns: repeat(4, 54px);
  justify-content: start;
  padding: 2px 0;
}

.photo-picker img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid transparent;
}

.photo-picker img.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 102, 60, 0.18);
}

.profile-photo-editor {
  grid-template-columns: 86px 1fr;
  align-items: center;
}

.profile-preview {
  width: 86px;
  height: 86px;
  aspect-ratio: 1 / 1;
  border-radius: 24px;
}

.fake-input,
.fake-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
  font-size: 14px;
}

.fake-input[contenteditable="true"],
.fake-textarea[contenteditable="true"] {
  outline: 0;
}

.save-note {
  padding: 11px 12px;
  border-radius: 12px;
  color: var(--leaf);
  background: #edf3ef;
  font-size: 13px;
  font-weight: 850;
}

.action-note {
  padding: 11px 12px;
  border-radius: 12px;
  color: var(--leaf);
  background: #edf3ef;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.45;
}

.action-note.warning,
.privacy-card {
  color: #8a4b32;
  background: #fbefe9;
  border-color: #f1d2c3;
}

.reply-composer {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.reply-composer strong {
  font-size: 14px;
}

.reply-composer span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.fake-textarea {
  min-height: 78px;
  line-height: 1.45;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
}

@media (max-width: 520px) {
  body {
    padding: 0;
    background: var(--paper);
  }

  .phone-shell {
    width: 100%;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

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