:root {
  --ink: #241d27;
  --muted: #756979;
  --paper: rgba(255, 252, 255, 0.88);
  --paper-solid: #fffafd;
  --line: rgba(255, 255, 255, 0.58);
  --line-dark: rgba(121, 92, 124, 0.18);
  --pink: #d57ca9;
  --pink-dark: #a9477e;
  --lavender: #a997d5;
  --violet: #6c5aa0;
  --mint: #72b9a6;
  --sky: #9ad7dc;
  --wood: #b4764c;
  --red: #c75558;
  --gold: #d8a13c;
  --shadow: 0 18px 44px rgba(57, 40, 58, 0.18);
  --bottom-nav-height: 86px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #160f18;
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: #160f18;
  color: var(--ink);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Segoe UI",
    Arial,
    sans-serif;
}

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

button {
  cursor: pointer;
}

button,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

.mobile-app {
  position: relative;
  min-height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(255, 235, 245, 0.08) 0, rgba(255, 243, 249, 0.96) 520px),
    #fff2f8;
}

.photo-backdrop {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 0;
  height: 430px;
  max-width: 520px;
  margin: 0 auto;
  background-image:
    linear-gradient(180deg, rgba(85, 35, 70, 0.12), rgba(213, 124, 169, 0.13) 54%, rgba(255, 239, 247, 0.94) 100%),
    var(--active-photo);
  background-color: #e6b8cf;
  background-position: top center;
  background-repeat: no-repeat;
  background-size: contain;
}

.mobile-app::before {
  position: absolute;
  inset: 0;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 234, 244, 0.38), transparent 22%),
    radial-gradient(circle at 78% 8%, rgba(132, 215, 209, 0.25), transparent 25%),
    linear-gradient(180deg, transparent 0 60%, rgba(255, 241, 248, 0.9) 84% 100%);
  content: "";
  pointer-events: none;
}

.app-header,
.app-content,
.bottom-nav {
  position: relative;
  z-index: 2;
}

.app-header {
  min-height: 520px;
  padding: calc(16px + var(--safe-top)) 16px 12px;
  color: #fff;
}

.top-bar {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-mark,
.install-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  backdrop-filter: blur(14px);
}

.app-mark {
  padding: 0 12px;
  font-size: 0.82rem;
  font-weight: 900;
}

.install-button {
  padding: 0 13px;
  font-weight: 900;
}

.hero-panel {
  width: min(100%, 360px);
  margin-top: 252px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 22px 54px rgba(39, 23, 39, 0.22);
  backdrop-filter: blur(18px);
}

.eyebrow {
  margin: 0 0 6px;
  color: inherit;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0;
  opacity: 0.78;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 7px;
  font-size: 2.2rem;
  line-height: 1.02;
  text-shadow: 0 8px 28px rgba(43, 28, 45, 0.38);
}

.hero-date {
  margin-bottom: 16px;
  font-size: 0.94rem;
  font-weight: 700;
  opacity: 0.88;
}

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

.hero-stats div {
  min-height: 64px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.19);
}

.hero-stats span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 900;
  opacity: 0.72;
}

.hero-stats strong {
  display: block;
  overflow: hidden;
  font-size: 1.2rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.week-strip {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(7, minmax(42px, 1fr));
  gap: 6px;
  margin-top: 14px;
}

.day-pill {
  min-height: 66px;
  padding: 8px 4px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  text-align: center;
  backdrop-filter: blur(12px);
}

.day-pill.active {
  border-color: rgba(255, 255, 255, 0.84);
  background: rgba(255, 255, 255, 0.88);
  color: var(--pink-dark);
  box-shadow: 0 12px 26px rgba(51, 30, 52, 0.18);
}

.day-pill.today {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.38);
}

.day-pill span,
.day-pill strong {
  display: block;
}

.day-pill span {
  margin-bottom: 4px;
  font-size: 0.68rem;
  font-weight: 900;
  opacity: 0.8;
}

.day-pill strong {
  font-size: 1rem;
  line-height: 1;
}

.day-dot {
  width: 5px;
  height: 5px;
  margin: 7px auto 0;
  border-radius: 50%;
  background: currentColor;
  opacity: 0;
}

.day-pill.has-events .day-dot {
  opacity: 0.95;
}

.app-content {
  margin-top: 0;
  padding: 0 14px calc(var(--bottom-nav-height) + var(--safe-bottom) + 20px);
}

.view-panel {
  min-height: 360px;
  padding: 18px 14px 20px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 24px 24px 0 0;
  background:
    linear-gradient(180deg, rgba(255, 251, 254, 0.94), rgba(255, 255, 255, 0.9)),
    repeating-linear-gradient(135deg, rgba(213, 124, 169, 0.04) 0 1px, transparent 1px 16px);
  box-shadow: var(--shadow);
}

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

.section-head .eyebrow {
  color: var(--pink-dark);
}

h2 {
  margin-bottom: 0;
  font-size: 1.26rem;
  line-height: 1.2;
}

h3 {
  margin-bottom: 10px;
  font-size: 0.96rem;
}

.small-button,
.soft-button,
.icon-button,
.save-button,
.danger-button,
.close-button {
  min-height: 40px;
  border: 1px solid var(--line-dark);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  font-weight: 900;
}

.small-button,
.soft-button {
  padding: 0 13px;
}

.icon-button,
.close-button {
  width: 42px;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
}

.week-nav {
  display: flex;
  gap: 8px;
}

.timeline,
.week-list {
  display: grid;
  gap: 10px;
}

.timeline-item,
.week-day {
  border: 1px solid rgba(130, 92, 132, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 10px 24px rgba(89, 64, 92, 0.1);
}

.timeline-item {
  display: grid;
  grid-template-columns: 76px 58px minmax(0, 1fr);
  min-height: 82px;
  align-items: stretch;
  overflow: hidden;
}

.time-rail {
  display: grid;
  place-items: center;
  padding: 12px 8px;
  background: var(--event-bg);
  color: var(--event-color);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
}

.event-main {
  min-width: 0;
  padding: 13px 14px;
}

.event-sticker-wrap {
  display: grid;
  place-items: center;
  padding: 8px 0;
  background: rgba(255, 255, 255, 0.34);
}

.event-sticker {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  filter: drop-shadow(0 7px 12px rgba(82, 55, 82, 0.14));
}

.event-main strong {
  display: block;
  margin-bottom: 7px;
  overflow: hidden;
  font-size: 1rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.category-chip {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--event-bg);
  color: var(--event-color);
}

.event-note {
  display: block;
  margin-top: 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  min-height: 170px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(169, 151, 213, 0.5);
  border-radius: 20px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.week-day {
  padding: 14px;
}

.week-day-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.week-day-head strong {
  font-size: 1rem;
}

.week-day-head span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.week-event {
  display: grid;
  grid-template-columns: 34px 72px minmax(0, 1fr);
  gap: 10px;
  min-height: 42px;
  align-items: center;
  border-top: 1px solid rgba(121, 92, 124, 0.11);
  padding-top: 9px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.week-sticker {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
}

.week-event + .week-event {
  margin-top: 8px;
}

.week-event strong {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setting-block {
  padding: 14px;
  border: 1px solid rgba(130, 92, 132, 0.16);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.68);
}

.setting-block + .setting-block {
  margin-top: 12px;
}

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

.sync-status {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  padding: 0 12px;
  border-radius: 999px;
  background: #f5efff;
  color: var(--violet);
  font-size: 0.78rem;
  font-weight: 900;
}

.sync-status.online {
  background: #e8f4ef;
  color: #2f7f6f;
}

.sync-status.error {
  background: #fff2f4;
  color: var(--red);
}

.switch-row {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid rgba(121, 92, 124, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  font-weight: 900;
}

.switch-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--pink);
}

.compact-field {
  margin-bottom: 0;
}

.setting-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.45;
}

.background-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.background-library-item {
  position: relative;
  min-width: 0;
}

.background-option {
  width: 100%;
  min-height: 148px;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 18px;
  background: transparent;
  padding: 0;
}

.background-option.active {
  border-color: var(--pink);
  box-shadow: 0 12px 28px rgba(213, 124, 169, 0.22);
}

.background-option img {
  display: block;
  width: 100%;
  height: 148px;
  object-fit: cover;
}

.background-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: rgba(36, 29, 39, 0.58);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1;
  backdrop-filter: blur(10px);
}

.custom-background {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.custom-background-card {
  position: relative;
  min-height: 156px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px dashed rgba(213, 124, 169, 0.36);
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255, 240, 247, 0.9), rgba(245, 239, 255, 0.9)),
    repeating-linear-gradient(135deg, rgba(213, 124, 169, 0.06) 0 1px, transparent 1px 16px);
}

.custom-background-card.active {
  border-style: solid;
  border-color: var(--pink);
  box-shadow: 0 12px 28px rgba(213, 124, 169, 0.22);
}

.custom-background-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.custom-background-empty {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  place-items: center;
  color: var(--pink-dark);
  font-weight: 900;
  text-align: center;
}

.custom-background-empty strong {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  font-size: 1.8rem;
  line-height: 1;
}

.custom-background-empty em {
  font-style: normal;
  font-size: 0.9rem;
}

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

.couple-grid {
  display: grid;
  gap: 12px;
}

.couple-card {
  padding: 14px;
  border: 1px solid rgba(130, 92, 132, 0.16);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.68);
}

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

.message-list,
.music-list {
  display: grid;
  gap: 9px;
  margin-bottom: 12px;
}

.message-item,
.music-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(121, 92, 124, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
}

.message-item p,
.music-item p {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.45;
  word-break: break-word;
}

.message-meta,
.music-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.delete-inline,
.music-open {
  min-height: 32px;
  border: 1px solid rgba(121, 92, 124, 0.16);
  border-radius: 999px;
  padding: 0 10px;
  background: #fff0f7;
  color: var(--pink-dark);
  font-size: 0.74rem;
  font-weight: 900;
  text-decoration: none;
}

.music-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
}

.empty-mini {
  min-height: 88px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(169, 151, 213, 0.32);
  border-radius: 16px;
  color: var(--muted);
  font-weight: 900;
  text-align: center;
}

.full-button {
  width: 100%;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  max-width: 520px;
  min-height: calc(var(--bottom-nav-height) + var(--safe-bottom));
  display: grid;
  grid-template-columns: 1fr 1fr 68px 1fr 1fr;
  gap: 6px;
  align-items: center;
  margin: 0 auto;
  padding: 9px 14px calc(9px + var(--safe-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.62);
  background: rgba(255, 250, 254, 0.86);
  box-shadow: 0 -18px 42px rgba(72, 48, 76, 0.16);
  backdrop-filter: blur(20px);
}

.nav-button {
  min-height: 58px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.nav-button span,
.nav-button strong {
  display: block;
}

.nav-button span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  margin: 0 auto 3px;
  border-radius: 50%;
  background: rgba(169, 151, 213, 0.13);
  font-size: 0.78rem;
}

.nav-button strong {
  font-size: 0.68rem;
}

.nav-button.active {
  color: var(--pink-dark);
}

.nav-button.active span {
  background: #fff0f7;
}

.add-button {
  width: 62px;
  height: 62px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--pink), var(--lavender));
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  box-shadow: 0 14px 30px rgba(169, 86, 142, 0.34);
}

.event-sheet {
  position: fixed;
  inset: auto 0 0;
  width: min(520px, 100vw);
  max-width: 520px;
  max-height: 92dvh;
  margin: 0 auto;
  border: 0;
  padding: 0;
  background: transparent;
  overflow: visible;
}

.event-sheet[open] {
  display: grid;
  align-items: end;
}

.event-sheet::backdrop {
  background: rgba(31, 20, 32, 0.48);
  backdrop-filter: blur(4px);
}

.sheet-form {
  padding: 18px 16px calc(18px + var(--safe-bottom));
  border-radius: 24px 24px 0 0;
  background:
    linear-gradient(180deg, #fffafd, #ffffff),
    repeating-linear-gradient(135deg, rgba(213, 124, 169, 0.04) 0 1px, transparent 1px 16px);
  box-shadow: 0 -20px 52px rgba(43, 28, 45, 0.24);
}

.sheet-header,
.sheet-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sheet-header {
  justify-content: space-between;
  margin-bottom: 14px;
}

.sheet-header .eyebrow {
  color: var(--pink-dark);
}

.sheet-header h2 {
  margin-bottom: 0;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(121, 92, 124, 0.2);
  border-radius: 16px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font-weight: 700;
}

.field textarea {
  resize: vertical;
  line-height: 1.45;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 3px solid rgba(213, 124, 169, 0.18);
  border-color: var(--pink);
}

.icon-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.icon-choice {
  min-height: 78px;
  display: grid;
  place-items: center;
  gap: 4px;
  border: 2px solid transparent;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.icon-choice.active {
  border-color: var(--pink);
  background: #fff0f7;
  color: var(--pink-dark);
  box-shadow: 0 10px 22px rgba(213, 124, 169, 0.18);
}

.icon-choice img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 10px;
}

.form-grid .field:first-child,
.form-grid .field:last-child {
  grid-column: 1 / -1;
}

.sheet-actions {
  margin-top: 4px;
}

.sheet-spacer {
  flex: 1;
}

.save-button {
  min-width: 132px;
  border-color: transparent;
  background: linear-gradient(145deg, var(--pink), var(--lavender));
  color: #fff;
  box-shadow: 0 12px 26px rgba(169, 86, 142, 0.24);
}

.danger-button {
  padding: 0 14px;
  border-color: rgba(199, 85, 88, 0.22);
  background: #fff2f4;
  color: var(--red);
}

.toast {
  position: fixed;
  right: 16px;
  bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 14px);
  left: 16px;
  z-index: 20;
  max-width: 488px;
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(36, 29, 39, 0.92);
  color: #fff;
  box-shadow: var(--shadow);
  text-align: center;
  backdrop-filter: blur(14px);
}

@media (min-width: 700px) {
  body {
    background:
      linear-gradient(135deg, rgba(213, 124, 169, 0.25), rgba(114, 185, 166, 0.18)),
      #1b1320;
  }

  .mobile-app,
  .photo-backdrop,
  .mobile-app::before,
  .bottom-nav {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 20px 70px rgba(0, 0, 0, 0.32);
  }
}

@media (max-width: 370px) {
  .app-header {
    min-height: 492px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .hero-panel {
    margin-top: 230px;
    padding: 15px;
  }

  h1 {
    font-size: 1.96rem;
  }

  .day-pill {
    min-height: 60px;
  }

  .app-content {
    padding-right: 10px;
    padding-left: 10px;
  }
}
