:root {
  color-scheme: light;
  --bg: #f7f2ed;
  --surface: #fffdfb;
  --surface-soft: #fbf7f3;
  --pink: #f3dada;
  --pink-strong: #a56f74;
  --blue: #dbe9f4;
  --blue-strong: #607d91;
  --sage: #cbdccf;
  --sage-strong: #55705d;
  --ink: #293338;
  --muted: #748087;
  --line: #e5ddd7;
  --danger: #a34c4c;
  --warning: #a66b2d;
  --radius: 8px;
  --shadow: 0 10px 28px rgba(52, 43, 37, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

button,
label {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.eyebrow {
  margin: 0 0 2px;
  color: var(--pink-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.soft-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

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

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--pink);
  color: var(--pink-strong);
  font-size: 23px;
  font-weight: 800;
}

.login-card {
  width: min(420px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.login-heading h1 {
  margin: 0;
  font-size: 21px;
}

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

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

.login-card label {
  margin-top: 7px;
  color: #4f5c62;
  font-size: 13px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

input,
select {
  height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 112px;
  padding: 11px 12px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #c99da2;
  box-shadow: 0 0 0 3px rgba(165, 111, 116, 0.11);
}

.form-error {
  margin: 7px 0;
  color: var(--danger);
  font-size: 13px;
}

.button {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 16px;
  cursor: pointer;
  font-weight: 700;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

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

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

.button.primary:hover {
  background: #8e5f64;
}

.button.secondary {
  border: 1px solid var(--line);
  background: var(--surface);
}

.button.secondary:hover {
  border-color: #c9b7af;
}

.button.wide {
  width: 100%;
}

.privacy-note {
  margin-top: 18px;
  text-align: center;
}

.app-shell {
  width: min(820px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 72px;
  padding: 11px 16px;
  border-bottom: 1px solid rgba(229, 221, 215, 0.92);
  background: rgba(247, 242, 237, 0.97);
}

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

.couple-brand h1 {
  margin: 0;
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.couple-brand p {
  margin: 1px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-stack {
  position: relative;
  width: 54px;
  height: 40px;
  flex: 0 0 auto;
}

.avatar-stack img {
  position: absolute;
  top: 0;
  width: 40px;
  height: 40px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  object-fit: cover;
}

.avatar-stack img:first-child {
  left: 0;
}

.avatar-stack img:last-child {
  left: 16px;
}

.icon-button {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
}

.icon-button svg,
.nav-item svg,
.upload-box svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-main {
  padding: 14px 14px 6px;
}

.view {
  display: grid;
  gap: 14px;
}

.card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

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

.section-title h2,
.view-heading h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
}

.text-button {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--pink-strong);
  padding: 0 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.text-button:hover {
  color: #814f55;
}

.timer-card {
  background: var(--surface);
}

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

.timer-grid div {
  min-width: 0;
  padding: 11px 4px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  text-align: center;
}

.timer-grid strong {
  display: block;
  overflow: hidden;
  font-size: 22px;
  line-height: 1.1;
  text-overflow: ellipsis;
}

.timer-grid span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 9px;
}

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

.inline-form .button {
  flex: 0 0 auto;
}

.photo-button {
  width: 100%;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  background: var(--surface-soft);
  cursor: zoom-in;
}

.photo-button img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.highlight-card > .muted {
  margin-top: 9px;
}

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

.compact-list.spaced {
  margin-top: 14px;
}

.compact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.compact-item.soon {
  border-color: #e4c0a1;
  background: #fff7ed;
}

.compact-item.today {
  border-color: #db9c9c;
  background: #fff2f2;
}

.compact-item strong {
  display: block;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-item small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.compact-item .item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.view-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 2px 0;
}

.compose-card {
  display: grid;
  gap: 10px;
}

.compose-card label {
  color: #4f5c62;
  font-size: 13px;
  font-weight: 700;
}

.compose-card.embedded {
  border: 0;
  padding: 0;
  box-shadow: none;
}

.message-list,
.wish-list,
.diary-list {
  display: grid;
  gap: 10px;
}

.message-item {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.sender-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-weight: 700;
}

.sender-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pink-strong);
}

.sender-dot.partner {
  background: var(--blue-strong);
}

.message-item p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.wish-item,
.diary-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.wish-check {
  width: 24px;
  height: 24px;
  margin: 1px 0 0;
  accent-color: var(--sage-strong);
}

.wish-content,
.diary-content {
  min-width: 0;
}

.wish-content strong,
.diary-content strong {
  display: block;
  overflow-wrap: anywhere;
}

.wish-item.done .wish-content strong {
  color: var(--muted);
  text-decoration: line-through;
}

.item-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.delete-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--danger);
  cursor: pointer;
}

.delete-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.upload-box {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 140px;
  border: 1px dashed #cdbdb4;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--pink-strong);
  cursor: pointer;
  text-align: center;
}

.upload-box small {
  color: var(--muted);
}

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

.photo-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.photo-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  cursor: zoom-in;
}

.photo-card-body {
  padding: 9px 10px 10px;
}

.photo-card-body p {
  min-height: 20px;
  margin: 0;
  color: #566268;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.photo-card footer {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.photo-delete {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 253, 251, 0.92);
  color: var(--danger);
  cursor: pointer;
}

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

.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #536067;
  font-size: 13px;
}

.check-line input {
  width: 18px;
  height: 18px;
}

.diary-item {
  grid-template-columns: minmax(0, 1fr) auto;
}

.diary-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.diary-body {
  margin: 9px 0 0;
  color: #4d595f;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.visibility-chip {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--blue);
  color: var(--blue-strong);
  font-size: 11px;
}

.empty-state {
  padding: 26px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.empty-state.full {
  grid-column: 1 / -1;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  min-height: calc(66px + env(safe-area-inset-bottom));
  padding: 5px 6px env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 251, 0.98);
}

.nav-item {
  min-width: 0;
  display: grid;
  place-items: center;
  gap: 1px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #7d878c;
  cursor: pointer;
  font-size: 11px;
}

.nav-item.active {
  background: #f7efeb;
  color: var(--pink-strong);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(82px + env(safe-area-inset-bottom));
  z-index: 50;
  width: min(360px, calc(100% - 32px));
  transform: translateX(-50%);
  padding: 12px 14px;
  border: 1px solid #dfc4c7;
  border-radius: var(--radius);
  background: #fff7f7;
  color: #724c51;
  box-shadow: var(--shadow);
  text-align: center;
  font-size: 13px;
}

.photo-dialog {
  width: min(760px, calc(100% - 24px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface);
  color: var(--ink);
}

.photo-dialog::backdrop {
  background: rgba(41, 51, 56, 0.72);
}

.photo-dialog img {
  width: 100%;
  max-height: 72vh;
  border-radius: 6px;
  object-fit: contain;
}

.photo-dialog p {
  margin: 10px 4px 0;
  color: #556168;
}

.dialog-close {
  float: right;
  min-height: 32px;
  margin: 0 0 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}

@media (min-width: 700px) {
  .app-main {
    padding: 20px 24px 8px;
  }

  .card {
    padding: 20px;
  }

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

  .bottom-nav {
    left: 50%;
    right: auto;
    width: min(820px, 100%);
    transform: translateX(-50%);
    border-right: 1px solid var(--line);
    border-left: 1px solid var(--line);
  }
}

@media (max-width: 520px) {
  .timer-grid strong {
    font-size: 19px;
  }

  .mobile-stack {
    align-items: stretch;
    flex-direction: column;
  }

  .mobile-stack .button {
    width: 100%;
  }
}
