:root {
  color-scheme: light;
  --bg: #fff8fb;
  --ink: #3a2430;
  --muted: #8d6978;
  --soft: #fff1f6;
  --soft-2: #fff7e8;
  --card: rgba(255, 255, 255, .88);
  --line: rgba(122, 58, 86, .13);
  --primary: #ff7aa8;
  --primary-strong: #e84e83;
  --peach: #ffaf8e;
  --danger: #bd4260;
  --shadow: 0 18px 48px rgba(146, 73, 104, .11);
  --radius: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 5%, rgba(255, 207, 224, .95) 0, transparent 24rem),
    radial-gradient(circle at 90% 8%, rgba(255, 238, 187, .8) 0, transparent 22rem),
    linear-gradient(180deg, #fff8fb 0%, #fff1f7 46%, #fff8ed 100%);
  color: var(--ink);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255, 122, 168, .12) 1px, transparent 1px),
    radial-gradient(circle, rgba(255, 185, 135, .11) 1px, transparent 1px);
  background-size: 34px 34px, 52px 52px;
  opacity: .62;
}

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

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

button {
  border: 0;
  border-radius: 999px;
  min-height: 44px;
  padding: 0 18px;
  background: linear-gradient(135deg, var(--primary), var(--peach));
  color: white;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(255, 122, 168, .24);
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

button:hover {
  box-shadow: 0 14px 30px rgba(255, 122, 168, .3);
}

button:active {
  transform: translateY(1px) scale(.99);
}

button:disabled {
  cursor: not-allowed;
  opacity: .58;
  box-shadow: none;
}

.secondary,
.ghost,
.mini-button {
  background: #fff;
  color: var(--primary-strong);
  border: 1px solid rgba(255, 122, 168, .24);
  box-shadow: none;
}

.ghost {
  color: var(--muted);
  background: #fff7fa;
}

.small {
  min-height: 36px;
  padding: 0 13px;
  font-size: 13px;
}

.full {
  width: 100%;
}

.decor-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.decor-layer span {
  position: absolute;
  left: var(--x);
  bottom: -48px;
  color: rgba(255, 122, 168, .26);
  font-size: calc(26px * var(--s));
  animation: floatUp 13s linear infinite;
  animation-delay: var(--d);
}

@keyframes floatUp {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 0;
  }
  16% {
    opacity: .8;
  }
  100% {
    transform: translate3d(18px, -112vh, 0) rotate(22deg);
    opacity: 0;
  }
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 960px);
  margin: 0 auto;
  padding: 16px 16px calc(92px + env(safe-area-inset-bottom));
}

.section-anchor {
  scroll-margin-top: 16px;
}

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

.hero,
.card,
.status-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 430px;
  padding: 22px;
  color: white;
  background:
    linear-gradient(150deg, rgba(255, 105, 158, .94), rgba(255, 174, 139, .78)),
    url("./hero.svg") center/cover;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
}

.hero::before {
  width: 180px;
  height: 180px;
  right: -70px;
  top: 44px;
}

.hero::after {
  width: 120px;
  height: 120px;
  left: -42px;
  bottom: 88px;
}

.hero-glow {
  position: absolute;
  inset: auto -20% -30% -20%;
  height: 230px;
  background: radial-gradient(circle, rgba(255, 255, 255, .35), transparent 64%);
  animation: pulse 4.8s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    transform: scale(1.08);
    opacity: .78;
  }
}

.hero > *:not(.hero-glow) {
  position: relative;
  z-index: 1;
}

.hero-top,
.section-title,
.dialog-head,
.dialog-actions,
.button-row,
.calendar-tools,
.calendar-shortcuts,
.progress-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title {
  align-items: flex-start;
}

.section-title.compact {
  align-items: center;
}

.section-title p,
.status-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.hero .section-title p,
.hero p {
  color: rgba(255, 255, 255, .84);
}

.eyebrow {
  margin: 0 0 7px;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .88;
}

.eyebrow.soft {
  color: var(--primary-strong);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(32px, 7vw, 46px);
  line-height: 1.05;
  text-shadow: 0 10px 30px rgba(86, 34, 56, .2);
}

h2 {
  margin-bottom: 0;
  font-size: 19px;
}

h3 {
  margin-bottom: 0;
  font-size: 17px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  padding: 0;
  font-size: 18px;
}

.glass {
  background: rgba(255, 255, 255, .23);
  border: 1px solid rgba(255, 255, 255, .24);
  color: white;
  backdrop-filter: blur(14px);
  box-shadow: none;
}

.avatar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
}

.avatar {
  width: 58px;
  height: 58px;
  border: 2px solid rgba(255, 255, 255, .64);
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: rgba(255, 255, 255, .22);
  color: white;
  font-weight: 900;
  font-size: 22px;
  box-shadow: 0 10px 24px rgba(83, 29, 52, .16);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-heart {
  font-size: 26px;
  opacity: .9;
}

.hero-copy {
  margin: 48px 0 20px;
  max-width: 680px;
}

.hero-copy p {
  margin-bottom: 8px;
}

.hero-copy strong {
  display: block;
  font-size: clamp(21px, 5vw, 30px);
  line-height: 1.36;
}

.hero-stats {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 10px;
}

.stat-card {
  display: grid;
  gap: 5px;
  min-height: 120px;
  padding: 16px;
  border-radius: 23px;
  background: rgba(255, 255, 255, .23);
  backdrop-filter: blur(16px);
}

.stat-card strong {
  font-size: clamp(36px, 12vw, 66px);
  line-height: .95;
  letter-spacing: -1px;
}

.status-card,
.card {
  padding: 16px;
}

.status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
}

.status-card strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-card[data-state="syncing"] strong::before,
.loading-dot {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  50% {
    opacity: .25;
  }
}

.field-label,
.dialog-card label {
  display: grid;
  gap: 8px;
  font-weight: 800;
  color: var(--ink);
}

.field-label {
  margin: 14px 0 8px;
  font-size: 14px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  color: var(--ink);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

input,
select {
  min-height: 46px;
  padding: 0 14px;
}

textarea {
  min-height: 96px;
  padding: 12px 14px;
  line-height: 1.65;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(255, 122, 168, .14);
}

.daily-editor {
  display: grid;
  gap: 10px;
}

.message-bubble,
.quote-text {
  margin: 14px 0 0;
  border-radius: 22px;
  padding: 16px;
  background: linear-gradient(135deg, #fff4f8, #fff8e6);
  color: var(--muted);
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.history-box {
  margin-top: 14px;
  color: var(--muted);
}

.history-box summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--primary-strong);
}

.history-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.stack-list,
.memory-timeline,
.compact-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.compact-list {
  margin-top: 10px;
}

.item-card,
.memory-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  overflow: hidden;
}

.item-card {
  padding: 14px;
}

.item-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.item-main strong {
  display: block;
  margin-bottom: 5px;
  font-size: 16px;
}

.item-meta,
.empty-state,
.history-item,
.tagline {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.item-note {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.item-actions,
.memory-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.danger {
  color: var(--danger);
  border-color: rgba(189, 66, 96, .22);
}

.badge-row,
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge-row {
  margin-top: 8px;
}

.badge,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 800;
}

.chip {
  border: 1px solid rgba(255, 122, 168, .18);
  background: #fff;
  cursor: pointer;
}

.chip.active {
  background: var(--primary);
  color: white;
}

.calendar-tools {
  display: grid;
  grid-template-columns: auto 1fr auto;
  margin-top: 16px;
}

.calendar-tools strong {
  text-align: center;
  align-self: center;
}

.calendar-shortcuts {
  justify-content: center;
  margin-top: 10px;
}

.week-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.week-row {
  margin-top: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.calendar-grid {
  margin-top: 8px;
}

.day-button {
  position: relative;
  min-height: 48px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  box-shadow: none;
  font-weight: 850;
}

.day-button.empty {
  visibility: hidden;
}

.day-button.weekend {
  color: var(--primary-strong);
  background: #fff8fb;
}

.day-button.today {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px rgba(255, 122, 168, .38);
}

.day-button.selected {
  background: linear-gradient(135deg, var(--primary), var(--peach));
  color: white;
}

.day-markers {
  position: absolute;
  left: 50%;
  bottom: 6px;
  display: flex;
  gap: 3px;
  transform: translateX(-50%);
}

.day-marker {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
}

.day-marker.event {
  background: #f3aa3d;
}

.selected .day-marker {
  background: white;
}

.day-detail {
  margin-top: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  padding: 14px;
  background: #fffafd;
}

.memory-card {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
}

.memory-card img,
.memory-image-fallback {
  width: 100%;
  height: 100%;
  min-height: 132px;
  object-fit: cover;
  background: linear-gradient(135deg, #fff0f6, #fff8df);
}

.memory-image-fallback {
  display: grid;
  place-items: center;
  color: var(--primary-strong);
  font-weight: 900;
  font-size: 28px;
}

.memory-body {
  padding: 14px;
  min-width: 0;
}

.memory-body h3 {
  margin: 0 0 5px;
  overflow-wrap: anywhere;
}

.memory-body p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.progress-line {
  margin-top: 14px;
}

.progress-track {
  flex: 1;
  height: 9px;
  border-radius: 999px;
  background: #ffe6ef;
  overflow: hidden;
}

.progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--primary), var(--peach));
  transition: width .3s ease;
}

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

.quote-card {
  margin-bottom: 8px;
}

.quote-text {
  font-size: 17px;
  color: var(--ink);
  transition: opacity .2s ease, transform .2s ease;
}

.quote-text.switching {
  opacity: 0;
  transform: translateY(5px);
}

dialog {
  width: min(calc(100% - 28px), 480px);
  border: 0;
  border-radius: 26px;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(48, 20, 34, .38);
  backdrop-filter: blur(5px);
}

dialog[open] .dialog-card {
  animation: dialogIn .18s ease both;
}

@keyframes dialogIn {
  from {
    transform: translateY(14px) scale(.98);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.dialog-card {
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 28px);
  padding: 18px;
  overflow: auto;
  border-radius: 26px;
  background: white;
}

.close-dialog {
  min-height: 38px;
  min-width: 38px;
  width: 38px;
  background: #fff5f9;
  color: var(--muted);
  border: 1px solid var(--line);
  box-shadow: none;
}

.avatar-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.file-label input {
  height: auto;
  padding: 10px;
  border-radius: 18px;
}

.memory-preview {
  display: none;
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 20px;
}

.tag-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.tag-options legend {
  padding: 0 6px;
  color: var(--muted);
  font-weight: 800;
}

.tag-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--primary-strong);
  font-weight: 800;
}

.tag-options input {
  width: auto;
  min-height: auto;
}

.bottom-tabs {
  position: fixed;
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(calc(100% - 24px), 520px);
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 16px 44px rgba(103, 43, 69, .16);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}

.bottom-tabs a,
.bottom-tabs button {
  display: grid;
  place-items: center;
  min-height: 38px;
  padding: 0 6px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
}

.bottom-tabs a:active,
.bottom-tabs button:active {
  background: var(--soft);
}

.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 20;
  display: grid;
  gap: 8px;
  width: min(calc(100% - 32px), 460px);
  pointer-events: none;
  transform: translateX(-50%);
}

.toast {
  border-radius: 18px;
  padding: 13px 15px;
  background: rgba(58, 36, 48, .92);
  color: white;
  box-shadow: 0 12px 30px rgba(58, 36, 48, .18);
  animation: toastIn .2s ease both;
}

@keyframes toastIn {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
}

.card {
  animation: cardIn .32s ease both;
}

@keyframes cardIn {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
}

@media (min-width: 760px) {
  .app-shell {
    padding-top: 24px;
  }

  .content-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .calendar-card,
  #memories,
  #quotes {
    grid-column: 1 / -1;
  }

  .hero {
    min-height: 470px;
    padding: 28px;
  }
}

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

  .hero {
    min-height: 420px;
    padding: 20px;
  }

  .hero-stats {
    grid-template-columns: 1fr;
  }

  .stat-card {
    min-height: auto;
  }

  .memory-card {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .button-row > button,
  .item-actions > button,
  .memory-actions > button {
    flex: 1;
  }

  .avatar-inputs {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
