:root {
  --pink-50: #fff7fa;
  --pink-100: #ffeaf1;
  --pink-200: #ffd6e3;
  --pink-300: #ffb8cd;
  --pink-400: #f88caa;
  --pink-500: #e86d91;
  --pink-600: #c95375;
  --rose: #9f4d67;
  --ink: #3d3037;
  --ink-soft: #76636b;
  --ink-faint: #a9949d;
  --cream: #fffdf9;
  --lavender: #eee8ff;
  --mint: #e8f7ef;
  --butter: #fff4d7;
  --sky: #e9f4ff;
  --mint-strong: #64ab89;
  --shadow: 0 18px 50px rgba(119, 65, 85, .12);
  --shadow-soft: 0 8px 24px rgba(121, 70, 88, .08);
  --line: rgba(104, 67, 80, .09);
  --app-width: 430px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
  background: #f7edf0;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 255, 255, .95) 0 12%, transparent 38%),
    radial-gradient(circle at 88% 90%, rgba(255, 217, 228, .8), transparent 34%),
    linear-gradient(145deg, #f8ecef, #f3e8fa 52%, #f8eee4);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

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

button {
  color: inherit;
}

button,
[role="button"] {
  touch-action: manipulation;
}

.svg-sprite {
  position: fixed;
  width: 0;
  height: 0;
  overflow: hidden;
}

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

/* Cover */
.cover-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: max(18px, var(--safe-top)) 16px max(18px, var(--safe-bottom));
  background:
    radial-gradient(circle at 15% 12%, #fff9f1 0 6%, transparent 30%),
    radial-gradient(circle at 92% 88%, #ffcddd 0 3%, transparent 30%),
    linear-gradient(150deg, #8e5c71, #5d414f);
  transition: opacity .55s ease, visibility .55s ease;
}

.cover-screen::before,
.cover-screen::after {
  position: absolute;
  color: rgba(255, 255, 255, .1);
  font-family: Georgia, serif;
  font-size: clamp(90px, 20vw, 230px);
  line-height: 1;
  pointer-events: none;
  content: "nn";
}

.cover-screen::before {
  top: -4%;
  left: -2%;
  transform: rotate(-12deg);
}

.cover-screen::after {
  right: -1%;
  bottom: -7%;
  transform: rotate(8deg);
}

.cover-screen.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.cover-art-wrap {
  position: relative;
  width: min(100%, var(--app-width));
  height: min(calc(100dvh - 36px), 880px);
  overflow: hidden;
  isolation: isolate;
  border: 6px solid rgba(255, 255, 255, .76);
  border-radius: 38px;
  background: #f6cfd9;
  box-shadow: 0 36px 90px rgba(32, 15, 23, .34), 0 2px 0 rgba(255, 255, 255, .6) inset;
}

.cover-art,
.cover-custom-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-art {
  object-position: 50% 18%;
  transform: scale(1.015);
  animation: coverReveal 1.4s cubic-bezier(.2, .8, .2, 1) both;
}

.cover-custom-photo {
  display: none;
  z-index: 1;
  object-position: center;
}

.cover-custom-photo.has-image {
  display: block;
}

.cover-grain {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, .04) 0%, transparent 26%, transparent 55%, rgba(65, 38, 47, .01) 68%, rgba(62, 38, 48, .54) 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .018) 0 1px, transparent 1px 4px);
  pointer-events: none;
}

.cover-topline {
  position: absolute;
  top: 20px;
  right: 20px;
  left: 20px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #7b4256;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .18em;
}

.cover-photo-btn {
  padding: 7px 12px;
  border: 1px solid rgba(125, 70, 89, .16);
  border-radius: 999px;
  background: rgba(255, 250, 247, .83);
  backdrop-filter: blur(12px);
  color: #7a4b5c;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
}

.cover-sticker {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 6px 14px rgba(102, 52, 69, .15));
  animation: floatSoft 4.8s ease-in-out infinite;
}

.cover-sticker-star {
  top: 86px;
  right: 28px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 249, 246, .84);
  color: #de7e9d;
  font-size: 20px;
}

.cover-sticker-bow {
  top: 138px;
  left: 24px;
  font-size: 28px;
  transform: rotate(-13deg);
  animation-delay: -2.4s;
}

.cover-title {
  position: absolute;
  top: 34%;
  left: 25px;
  z-index: 3;
  color: #6c3449;
  text-shadow: 0 3px 16px rgba(255, 250, 246, .4);
}

.cover-title-kicker {
  margin-bottom: 5px;
  padding-left: 3px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .26em;
}

.cover-title h1 {
  margin: 0;
  font-family: "Arial Black", "SF Pro Display", -apple-system, sans-serif;
  font-size: clamp(54px, 16vw, 74px);
  font-weight: 900;
  line-height: .82;
  letter-spacing: -.075em;
  transform: scaleX(.92);
  transform-origin: left center;
}

.cover-title-cn {
  display: inline-flex;
  margin-top: 12px;
  padding: 6px 10px;
  border: 1px solid rgba(112, 58, 77, .14);
  border-radius: 999px;
  background: rgba(255, 250, 246, .73);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  backdrop-filter: blur(10px);
}

.cover-bottom-card {
  position: absolute;
  right: 16px;
  bottom: 18px;
  left: 16px;
  z-index: 4;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 17px 17px 19px;
  border: 1px solid rgba(255, 255, 255, .52);
  border-radius: 26px;
  background: rgba(255, 249, 246, .91);
  box-shadow: 0 16px 45px rgba(60, 29, 42, .18);
  backdrop-filter: blur(18px);
}

.cover-brand {
  color: #9d4b68;
  font-family: Georgia, "Songti SC", serif;
  font-size: 30px;
  font-style: italic;
  line-height: 1;
  letter-spacing: -.04em;
}

.cover-brand em {
  font-weight: 400;
}

.cover-bottom-card p {
  max-width: 220px;
  margin: 8px 0 0;
  color: #7b626c;
  font-size: 11px;
  line-height: 1.55;
}

.cover-enter {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  min-height: 48px;
  padding: 0 17px;
  border: 0;
  border-radius: 999px;
  background: #7b3f55;
  box-shadow: 0 8px 20px rgba(104, 50, 70, .22);
  color: white;
  font-size: 13px;
  font-weight: 700;
}

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

.cover-enter:active {
  transform: scale(.96);
}

/* Main shell */
.app-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, var(--app-width));
  height: 100dvh;
  max-height: 920px;
  margin: 0 auto;
  overflow: hidden;
  background:
    radial-gradient(circle at 103% 3%, rgba(255, 199, 216, .25), transparent 20%),
    radial-gradient(circle at -6% 55%, rgba(235, 225, 255, .28), transparent 20%),
    var(--pink-50);
  box-shadow: 0 28px 70px rgba(98, 57, 73, .17);
  opacity: 0;
  transform: translateY(18px) scale(.98);
  transition: opacity .55s ease, transform .55s cubic-bezier(.2, .8, .2, 1);
}

.app-shell.is-ready {
  opacity: 1;
  transform: none;
}

.topbar {
  position: relative;
  z-index: 30;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  padding: calc(15px + var(--safe-top)) 20px 11px;
  background: linear-gradient(to bottom, rgba(255, 247, 250, .98) 55%, rgba(255, 247, 250, .82) 80%, transparent);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.brand-lockup > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-lockup strong {
  color: var(--ink);
  font-family: Georgia, "Songti SC", serif;
  font-size: 21px;
  font-style: italic;
  line-height: 1;
  letter-spacing: -.04em;
}

.brand-lockup small {
  color: var(--ink-faint);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .02em;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border: 1px solid rgba(162, 76, 104, .13);
  border-radius: 50%;
  background: linear-gradient(145deg, #fff, #ffe1ea);
  color: #a64b69;
  box-shadow: 0 4px 11px rgba(160, 72, 104, .12);
}

.brand-face {
  font-family: Georgia, serif;
  font-size: 12px;
  font-style: italic;
  font-weight: 700;
}

.brand-ear {
  position: absolute;
  top: -4px;
  width: 10px;
  height: 14px;
  border: 1px solid rgba(162, 76, 104, .13);
  border-radius: 98% 30% 40% 40%;
  background: #ffe4ec;
  transform-origin: bottom center;
}

.brand-ear.left {
  left: 6px;
  transform: rotate(-27deg);
}

.brand-ear.right {
  right: 6px;
  transform: rotate(27deg);
}

.avatar-button {
  position: relative;
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border: 1px solid rgba(155, 75, 100, .1);
  border-radius: 14px;
  background: rgba(255, 255, 255, .78);
  box-shadow: var(--shadow-soft);
}

.avatar-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: #8c596b;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.avatar-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--pink-50);
  border-radius: 50%;
  background: #f28ba8;
}

.main-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 4px 16px 116px;
  scrollbar-width: none;
  scroll-behavior: smooth;
}

.main-content::-webkit-scrollbar {
  display: none;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: viewIn .42s cubic-bezier(.2, .8, .2, 1) both;
}

.page-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin: 11px 2px 16px;
}

.page-intro h2 {
  margin: 3px 0 0;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 29px;
  font-weight: 700;
  letter-spacing: -.03em;
}

.eyebrow {
  color: var(--pink-500);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .18em;
}

.round-icon-btn {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border: 1px solid rgba(153, 80, 104, .1);
  border-radius: 50%;
  background: rgba(255, 255, 255, .8);
  box-shadow: var(--shadow-soft);
}

.round-icon-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: #9a5b70;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

/* Shared cards */
.section-card {
  margin-top: 14px;
  padding: 17px;
  border: 1px solid rgba(126, 79, 95, .07);
  border-radius: 25px;
  background: rgba(255, 255, 255, .88);
  box-shadow: var(--shadow-soft);
}

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

.section-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.02em;
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 0;
  background: transparent;
  color: var(--pink-500);
  font-size: 11px;
  font-weight: 700;
}

.text-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--pink-100);
  color: var(--pink-600);
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.pill.mint {
  background: var(--mint);
  color: #438269;
}

.pill.lavender {
  background: var(--lavender);
  color: #6e64a4;
}

.empty-state {
  padding: 24px 12px;
  color: var(--ink-faint);
  font-size: 12px;
  text-align: center;
}

/* Finance */
.finance-hero {
  position: relative;
  overflow: hidden;
  padding: 22px 20px 18px;
  border-radius: 29px;
  background:
    radial-gradient(circle at 87% 10%, rgba(255, 255, 255, .5), transparent 25%),
    linear-gradient(135deg, #e98aa6, #d96f90 56%, #bd5f7e);
  box-shadow: 0 17px 35px rgba(185, 92, 121, .24);
  color: white;
}

.finance-hero::before {
  position: absolute;
  top: -32px;
  right: -28px;
  width: 132px;
  height: 132px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 50%;
  box-shadow: 0 0 0 22px rgba(255, 255, 255, .04), 0 0 0 44px rgba(255, 255, 255, .03);
  content: "";
}

.finance-hero::after {
  position: absolute;
  top: 55px;
  right: 32px;
  color: rgba(255, 255, 255, .18);
  font-family: Georgia, serif;
  font-size: 67px;
  font-style: italic;
  line-height: 1;
  content: "¥";
  transform: rotate(9deg);
}

.hero-label {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(255, 255, 255, .76);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
}

.hero-label span:last-child {
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, .19);
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  letter-spacing: 0;
}

.hero-money {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 44px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -.045em;
}

.hero-money small {
  margin-right: 2px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 22px;
  font-weight: 500;
}

.hero-subline {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: rgba(255, 255, 255, .69);
  font-size: 10px;
}

.hero-subline b {
  color: white;
  font-weight: 700;
}

.budget-track {
  position: relative;
  z-index: 1;
  height: 6px;
  margin-top: 103px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .2);
}

.budget-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #fff4dd, #ffe1eb);
  box-shadow: 0 0 15px rgba(255, 255, 255, .35);
  transition: width .7s ease;
}

.budget-meta {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  color: rgba(255, 255, 255, .62);
  font-size: 9px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
  margin-top: 13px;
}

.quick-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 12px 4px 11px;
  border: 1px solid rgba(131, 80, 97, .07);
  border-radius: 20px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 7px 18px rgba(121, 69, 87, .06);
  font-size: 10px;
  font-weight: 650;
}

.quick-card:active {
  background: var(--pink-100);
  transform: scale(.97);
}

.quick-icon {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border-radius: 13px;
  background: var(--pink-100);
  font-size: 17px;
}

.quick-card:nth-child(2) .quick-icon {
  background: var(--butter);
}

.quick-card:nth-child(3) .quick-icon {
  background: var(--lavender);
}

.quick-card:nth-child(4) .quick-icon {
  background: var(--mint);
}

.insight-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 13px;
  padding: 13px 14px;
  border: 1px solid rgba(194, 143, 93, .11);
  border-radius: 20px;
  background: linear-gradient(105deg, #fff9ed, #fff4f8);
}

.insight-mascot {
  display: grid;
  flex: 0 0 39px;
  width: 39px;
  height: 39px;
  place-items: center;
  border-radius: 14px;
  background: white;
  font-size: 20px;
  box-shadow: 0 5px 15px rgba(126, 82, 73, .08);
}

.insight-card strong {
  display: block;
  margin-bottom: 3px;
  font-size: 12px;
}

.insight-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.45;
}

.transaction-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.transaction-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.transaction-item:last-child {
  border-bottom: 0;
}

.tx-icon {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border-radius: 14px;
  background: #fff1f5;
  font-size: 17px;
}

.tx-main {
  min-width: 0;
}

.tx-main strong {
  display: block;
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tx-main span {
  display: block;
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 9px;
}

.tx-money {
  font-family: "SF Pro Rounded", -apple-system, sans-serif;
  font-size: 12px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.tx-money.expense {
  color: var(--ink);
}

.tx-money.income {
  color: #4d9778;
}

.tx-money.family {
  color: #8267a8;
}

.savings-scroll {
  display: flex;
  gap: 10px;
  margin: 0 -17px;
  padding: 0 17px 4px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}

.savings-scroll::-webkit-scrollbar {
  display: none;
}

.saving-card {
  flex: 0 0 205px;
  min-height: 138px;
  padding: 15px;
  border: 1px solid rgba(125, 74, 92, .06);
  border-radius: 22px;
  background: linear-gradient(135deg, #fff5f8, #f7f0ff);
  scroll-snap-align: start;
}

.saving-card:nth-child(2n) {
  background: linear-gradient(135deg, #fff9e9, #fff1f4);
}

.saving-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.saving-emoji {
  display: grid;
  width: 37px;
  height: 37px;
  place-items: center;
  border-radius: 13px;
  background: rgba(255, 255, 255, .78);
  font-size: 18px;
}

.saving-card h4 {
  margin: 9px 0 3px;
  font-size: 13px;
}

.saving-card p {
  margin: 0;
  color: var(--ink-faint);
  font-size: 9px;
}

.mini-progress {
  height: 5px;
  margin: 10px 0 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(144, 95, 113, .1);
}

.mini-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pink-300), var(--pink-500));
}

.saving-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9px;
  font-weight: 650;
}

.saving-bottom b {
  color: var(--pink-600);
}

.deposit-btn {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .8);
  color: var(--pink-600);
  font-size: 9px;
  font-weight: 700;
  box-shadow: 0 3px 8px rgba(117, 68, 86, .06);
}

.category-bars {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.category-bar {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 54px;
  align-items: center;
  gap: 9px;
  font-size: 10px;
}

.category-bar > span:first-child {
  overflow: hidden;
  color: var(--ink-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-bar-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #f4edf0;
}

.category-bar-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffc2d2, #ef8ba8);
}

.category-bar b {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  text-align: right;
}

/* Plans */
.countdown-card {
  position: relative;
  overflow: hidden;
  min-height: 195px;
  padding: 20px;
  border-radius: 29px;
  background:
    radial-gradient(circle at 86% 16%, rgba(255, 255, 255, .54), transparent 25%),
    linear-gradient(140deg, #eeddf5, #f8d6e2 60%, #f7dfcf);
  box-shadow: 0 17px 38px rgba(135, 88, 115, .14);
}

.countdown-card::after {
  position: absolute;
  right: -24px;
  bottom: -45px;
  width: 145px;
  height: 145px;
  border: 35px solid rgba(255, 255, 255, .24);
  border-radius: 50%;
  content: "";
}

.countdown-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.countdown-top > span {
  color: #7c5673;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .06em;
}

.countdown-top button {
  padding: 6px 9px;
  border: 1px solid rgba(113, 75, 105, .11);
  border-radius: 999px;
  background: rgba(255, 255, 255, .55);
  color: #765369;
  font-size: 9px;
  font-weight: 700;
}

.countdown-title {
  position: relative;
  z-index: 1;
  max-width: 318px;
  margin: 18px 0 12px;
  color: #533a4e;
  font-family: "Songti SC", "STSong", serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
}

.countdown-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.countdown-cell {
  padding: 9px 4px 8px;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 15px;
  background: rgba(255, 255, 255, .46);
  text-align: center;
  backdrop-filter: blur(7px);
}

.countdown-cell strong {
  display: block;
  color: #5e4053;
  font-family: Georgia, serif;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.countdown-cell span {
  display: block;
  margin-top: 5px;
  color: #8f7181;
  font-size: 8px;
}

.countdown-date {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  color: #8d6b7c;
  font-size: 9px;
}

.countdown-empty .countdown-title {
  margin-bottom: 18px;
}

.countdown-empty .wide-action {
  position: relative;
  z-index: 2;
  width: auto;
  border-color: rgba(112, 72, 97, .12);
  background: rgba(255, 255, 255, .55);
}

.countdown-list-card {
  padding-bottom: 10px;
}

.countdown-list {
  display: flex;
  flex-direction: column;
}

.countdown-list-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.countdown-list-item:last-child {
  border-bottom: 0;
}

.countdown-list-icon {
  display: grid;
  width: 41px;
  height: 41px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff0f5, #f3edff);
  font-size: 19px;
}

.countdown-list-copy {
  min-width: 0;
}

.countdown-list-copy strong {
  display: block;
  overflow: hidden;
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.countdown-list-copy span {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.countdown-list-days {
  display: flex;
  min-width: 46px;
  align-items: baseline;
  justify-content: flex-end;
  gap: 2px;
  color: var(--pink-600);
  text-align: right;
}

.countdown-list-days b {
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
}

.countdown-list-days small {
  color: #ae8e9b;
  font-size: 8px;
}

.countdown-list-days.finished {
  color: #a8949d;
}

.countdown-list-days.finished b {
  font-family: -apple-system, sans-serif;
  font-size: 10px;
}

.week-card {
  padding-bottom: 15px;
}

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

.week-day {
  text-align: center;
}

.week-day span {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-faint);
  font-size: 8px;
}

.week-dot {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbf7f8;
  color: transparent;
  font-size: 12px;
  font-weight: 800;
}

.week-day.today .week-dot {
  border: 1px solid var(--pink-300);
  background: white;
  box-shadow: 0 3px 10px rgba(222, 114, 147, .12);
}

.week-day.done .week-dot {
  border-color: transparent;
  background: linear-gradient(135deg, var(--pink-200), var(--lavender));
  color: var(--pink-600);
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-item {
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fffafc;
  transition: opacity .2s, background .2s;
}

.task-item.completed {
  background: #f9f6f8;
  opacity: .65;
}

.task-check {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1.5px solid #e7b8c8;
  border-radius: 9px;
  background: white;
  color: transparent;
  font-size: 13px;
}

.task-item.completed .task-check {
  border-color: var(--pink-400);
  background: var(--pink-400);
  color: white;
}

.task-info {
  min-width: 0;
}

.task-info strong {
  display: block;
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-item.completed .task-info strong {
  text-decoration: line-through;
}

.task-info span {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 9px;
}

.task-info span i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #d4bdca;
}

.task-menu {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 0;
  background: transparent;
  color: #b69ca8;
  font-size: 18px;
}

.reminder-list {
  display: flex;
  flex-direction: column;
}

.reminder-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 31px;
  align-items: center;
  gap: 11px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.reminder-item:last-child {
  border-bottom: 0;
}

.reminder-date {
  padding: 7px 5px;
  border-radius: 12px;
  background: var(--pink-100);
  text-align: center;
}

.reminder-date strong {
  display: block;
  color: var(--pink-600);
  font-family: Georgia, serif;
  font-size: 17px;
  line-height: 1;
}

.reminder-date span {
  display: block;
  margin-top: 3px;
  color: #ac7d8e;
  font-size: 8px;
}

.reminder-info strong {
  display: block;
  font-size: 12px;
}

.reminder-info span {
  display: block;
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 9px;
}

.reminder-bell {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: #f7f2f5;
  color: #a47d8e;
}

.reminder-bell svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.wide-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-height: 43px;
  margin-top: 12px;
  border: 1px dashed #edb9c9;
  border-radius: 15px;
  background: #fffafb;
  color: var(--pink-600);
  font-size: 11px;
  font-weight: 700;
}

.wide-action svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

/* Diet */
.nutrition-hero {
  position: relative;
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  overflow: hidden;
  padding: 18px;
  border-radius: 29px;
  background:
    radial-gradient(circle at 88% 8%, rgba(255, 255, 255, .95), transparent 24%),
    linear-gradient(135deg, #fff1f4, #f3ebff);
  box-shadow: var(--shadow-soft);
}

.nutrition-hero::after {
  position: absolute;
  top: 12px;
  right: 14px;
  color: #d99ab0;
  font-size: 14px;
  content: "♡";
}

.calorie-ring {
  --progress: 30;
  position: relative;
  display: grid;
  width: 124px;
  height: 124px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--pink-400) calc(var(--progress) * 1%), rgba(219, 169, 186, .17) 0);
}

.calorie-ring::before {
  position: absolute;
  inset: 9px;
  border-radius: inherit;
  background: #fff9fb;
  box-shadow: inset 0 0 18px rgba(152, 89, 112, .04);
  content: "";
}

.ring-inner {
  position: relative;
  z-index: 1;
  text-align: center;
}

.ring-inner strong {
  display: block;
  font-family: Georgia, serif;
  font-size: 29px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.ring-inner span {
  display: block;
  margin-top: 4px;
  color: var(--ink-faint);
  font-size: 8px;
}

.nutrition-summary {
  min-width: 0;
}

.nutrition-summary .pill {
  margin-bottom: 9px;
}

.nutrition-summary h3 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 20px;
  line-height: 1.25;
}

.nutrition-summary > p {
  margin: 6px 0 12px;
  color: var(--ink-soft);
  font-size: 9px;
  line-height: 1.5;
}

.remaining-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--ink-faint);
  font-size: 9px;
}

.remaining-row b {
  color: var(--pink-600);
  font-family: Georgia, serif;
  font-size: 22px;
}

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

.body-stat {
  padding: 11px 8px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 255, 255, .78);
  text-align: center;
}

.body-stat strong {
  display: block;
  font-family: Georgia, serif;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.body-stat span {
  display: block;
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 8px;
}

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

.macro-card {
  position: relative;
  overflow: hidden;
  padding: 12px 11px;
  border-radius: 18px;
  background: #fff2f5;
}

.macro-card:nth-child(2) {
  background: #fff8e8;
}

.macro-card:nth-child(3) {
  background: #edf8f4;
}

.macro-card::after {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .35);
  content: "";
}

.macro-card span {
  color: var(--ink-faint);
  font-size: 8px;
  font-weight: 650;
}

.macro-card strong {
  display: block;
  margin-top: 5px;
  font-family: Georgia, serif;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.macro-card strong small {
  font-family: -apple-system, sans-serif;
  font-size: 8px;
}

.macro-card p {
  margin: 4px 0 0;
  color: var(--ink-faint);
  font-size: 8px;
}

.macro-track {
  height: 4px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(125, 76, 93, .08);
}

.macro-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #e889a5;
}

.macro-card:nth-child(2) .macro-track i {
  background: #d5ab5d;
}

.macro-card:nth-child(3) .macro-track i {
  background: #69aa8b;
}

.scan-feature {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 93px;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  margin-top: 14px;
  padding: 18px;
  border-radius: 25px;
  background:
    radial-gradient(circle at 84% 48%, rgba(255, 255, 255, .9), transparent 31%),
    linear-gradient(120deg, #dff2ee, #e8f7ef 45%, #fff2f6);
  box-shadow: var(--shadow-soft);
}

.scan-feature h3 {
  margin: 0;
  font-size: 16px;
}

.scan-feature p {
  max-width: 220px;
  margin: 6px 0 12px;
  color: #698076;
  font-size: 9px;
  line-height: 1.5;
}

.scan-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 12px;
  border: 0;
  border-radius: 999px;
  background: #4d876f;
  box-shadow: 0 6px 15px rgba(69, 125, 102, .18);
  color: white;
  font-size: 10px;
  font-weight: 700;
}

.scan-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.scan-orbit {
  position: relative;
  display: grid;
  width: 87px;
  height: 87px;
  place-items: center;
  border: 1px solid rgba(69, 132, 106, .13);
  border-radius: 50%;
  background: rgba(255, 255, 255, .66);
  box-shadow: 0 9px 24px rgba(69, 125, 102, .1);
}

.scan-orbit::before,
.scan-orbit::after {
  position: absolute;
  border: 1px solid rgba(84, 145, 120, .16);
  border-radius: 50%;
  content: "";
}

.scan-orbit::before {
  inset: -8px;
}

.scan-orbit::after {
  inset: 11px;
  border-style: dashed;
}

.scan-orbit span {
  position: relative;
  z-index: 1;
  font-size: 31px;
}

.meal-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 17px 3px 9px;
}

.meal-section-title h3 {
  margin: 0;
  font-size: 15px;
}

.meal-section-title span {
  color: var(--ink-faint);
  font-size: 9px;
}

.meal-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.meal-card {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, .84);
  box-shadow: 0 5px 16px rgba(120, 70, 88, .045);
}

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

.meal-emoji {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border-radius: 12px;
  background: var(--pink-100);
  font-size: 17px;
}

.meal-card:nth-child(2) .meal-emoji {
  background: var(--butter);
}

.meal-card:nth-child(3) .meal-emoji {
  background: var(--mint);
}

.meal-card:nth-child(4) .meal-emoji {
  background: var(--lavender);
}

.meal-name strong {
  display: block;
  font-size: 12px;
}

.meal-name span {
  display: block;
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 8px;
}

.meal-cal {
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.meal-cal small {
  color: var(--ink-faint);
  font-family: -apple-system, sans-serif;
  font-size: 7px;
}

.meal-foods {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed var(--line);
  color: var(--ink-faint);
  font-size: 8px;
}

.meal-foods span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meal-foods button {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: #f9f3f6;
  color: #a47688;
}

.meal-foods button svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.exercise-card {
  margin-top: 14px;
}

.exercise-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.exercise-row:last-of-type {
  border-bottom: 0;
}

.exercise-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 12px;
  background: #edf7f2;
  color: #5c9a7b;
}

.exercise-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.exercise-row strong {
  display: block;
  font-size: 11px;
}

.exercise-row p {
  margin: 3px 0 0;
  color: var(--ink-faint);
  font-size: 8px;
}

.exercise-row b {
  color: #549274;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* Diary */
.diary-hero {
  position: relative;
  overflow: hidden;
  padding: 19px 19px 18px;
  border-radius: 29px;
  background:
    radial-gradient(circle at 87% 18%, rgba(255, 255, 255, .9), transparent 27%),
    linear-gradient(135deg, #f3e6ff, #ffe6ef 57%, #fff2df);
  box-shadow: 0 16px 36px rgba(132, 89, 113, .12);
}

.diary-hero::before {
  position: absolute;
  top: -42px;
  right: -31px;
  width: 151px;
  height: 151px;
  border: 32px solid rgba(255, 255, 255, .24);
  border-radius: 50%;
  content: "";
}

.diary-hero::after {
  position: absolute;
  right: 24px;
  bottom: 71px;
  color: rgba(144, 91, 117, .34);
  font-family: Georgia, serif;
  font-size: 18px;
  content: "✦";
}

.diary-date-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.diary-day {
  display: grid;
  flex: 0 0 58px;
  width: 58px;
  height: 64px;
  place-items: center;
  border: 1px solid rgba(131, 83, 107, .1);
  border-radius: 18px;
  background: rgba(255, 255, 255, .68);
  box-shadow: 0 6px 17px rgba(108, 72, 88, .07);
}

.diary-day strong {
  align-self: end;
  color: #70495e;
  font-family: Georgia, serif;
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
}

.diary-day span {
  align-self: start;
  margin-top: 4px;
  color: #a27d8e;
  font-size: 8px;
  font-weight: 700;
}

.diary-date-copy span {
  display: block;
  color: #947083;
  font-size: 9px;
}

.diary-date-copy h3 {
  margin: 5px 0 0;
  color: #573c4d;
  font-family: "Songti SC", "STSong", serif;
  font-size: 19px;
  font-weight: 700;
}

.mood-label {
  position: relative;
  z-index: 1;
  display: block;
  margin: 17px 0 8px;
  color: #8d6b7c;
  font-size: 9px;
  font-weight: 650;
}

.mood-picker {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.mood-chip {
  display: flex;
  min-width: 0;
  min-height: 52px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid rgba(135, 89, 109, .08);
  border-radius: 15px;
  background: rgba(255, 255, 255, .58);
  color: #9b7e8b;
  font-size: 8px;
  font-weight: 650;
}

.mood-chip b {
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
}

.mood-chip.active {
  border-color: rgba(234, 124, 157, .22);
  background: white;
  box-shadow: 0 6px 14px rgba(138, 77, 100, .1);
  color: var(--pink-600);
  transform: translateY(-1px);
}

.diary-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
  margin-top: 14px;
}

.diary-paper {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border: 1px solid rgba(129, 85, 102, .07);
  border-radius: 25px;
  background:
    linear-gradient(90deg, transparent 0 31px, rgba(242, 157, 181, .12) 31px 32px, transparent 32px),
    repeating-linear-gradient(to bottom, transparent 0 28px, rgba(157, 116, 133, .065) 28px 29px),
    rgba(255, 255, 255, .9);
  box-shadow: var(--shadow-soft);
}

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

.diary-paper-head h3 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 17px;
}

.autosave-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #9f8591;
  font-size: 8px;
  white-space: nowrap;
}

.autosave-status::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #a8cbb9;
  content: "";
}

.diary-title-input,
.diary-textarea,
.reflection-textarea,
.spark-input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.diary-title-input {
  padding: 4px 0 7px;
  font-family: "Songti SC", "STSong", serif;
  font-size: 20px;
  font-weight: 700;
}

.diary-title-input::placeholder {
  color: #b99da9;
}

.diary-textarea {
  min-height: 156px;
  padding: 2px 0 10px;
  font-size: 13px;
  line-height: 29px;
  resize: none;
}

.diary-textarea::placeholder,
.reflection-textarea::placeholder,
.spark-input::placeholder {
  color: #c3aab4;
}

.diary-paper-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.diary-prompts {
  display: flex;
  min-width: 0;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.diary-prompts::-webkit-scrollbar {
  display: none;
}

.diary-prompt {
  flex: 0 0 auto;
  padding: 6px 8px;
  border: 1px solid #f1e2e8;
  border-radius: 999px;
  background: rgba(255, 250, 252, .92);
  color: #9c7485;
  font-size: 8px;
}

.diary-word-count {
  flex: 0 0 auto;
  color: #baa1ab;
  font-family: Georgia, serif;
  font-size: 9px;
}

.spark-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 10px 11px;
  border-radius: 14px;
  background: #fff8e9;
}

.spark-row span {
  font-size: 15px;
}

.spark-input {
  min-width: 0;
  flex: 1;
  font-size: 10px;
}

.reflection-card {
  padding: 17px;
  border: 1px solid rgba(124, 87, 108, .07);
  border-radius: 25px;
  background: rgba(255, 255, 255, .88);
  box-shadow: var(--shadow-soft);
}

.reflection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 13px;
}

.reflection-heading h3 {
  margin: 0;
  font-size: 16px;
}

.reflection-stack {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.reflection-block {
  padding: 12px 13px;
  border-radius: 17px;
  background: #fff6f9;
}

.reflection-block:nth-child(2) {
  background: #f4f1ff;
}

.reflection-block label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
  color: #876171;
  font-size: 9px;
  font-weight: 700;
}

.reflection-block label span {
  font-size: 12px;
}

.reflection-textarea {
  min-height: 60px;
  padding: 0;
  font-size: 11px;
  line-height: 1.6;
  resize: none;
}

.diary-save-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.diary-save-row p {
  margin: 0;
  color: var(--ink-faint);
  font-size: 8px;
  line-height: 1.5;
}

.diary-save-btn {
  display: inline-flex;
  flex: 0 0 auto;
  min-height: 43px;
  align-items: center;
  gap: 6px;
  padding: 0 17px;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(135deg, #e782a2, #cb5c80);
  box-shadow: 0 8px 18px rgba(202, 84, 122, .18);
  color: white;
  font-size: 10px;
  font-weight: 700;
}

.diary-save-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.diary-history {
  display: flex;
  flex-direction: column;
}

.diary-history-item {
  display: grid;
  grid-template-columns: 45px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.diary-history-item:last-child {
  border-bottom: 0;
}

.history-mood {
  display: grid;
  width: 43px;
  height: 43px;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(135deg, #fff0f5, #f2ecff);
  font-size: 21px;
}

.history-copy {
  min-width: 0;
}

.history-copy strong {
  display: block;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-copy span {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-date {
  color: #b195a1;
  font-family: Georgia, serif;
  font-size: 9px;
}

.diary-empty {
  padding: 18px 10px;
  color: var(--ink-faint);
  font-size: 10px;
  text-align: center;
}

/* Tab bar */
.tabbar {
  position: absolute;
  right: 12px;
  bottom: max(10px, var(--safe-bottom));
  left: 12px;
  z-index: 35;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  height: 68px;
  padding: 8px 7px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 25px;
  background: rgba(255, 252, 253, .88);
  box-shadow: 0 13px 35px rgba(98, 53, 70, .16);
  backdrop-filter: blur(22px);
}

.tab-button {
  display: flex;
  min-width: 0;
  height: 51px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: #a18c95;
  font-size: 7.5px;
  font-weight: 650;
}

.tab-icon {
  display: grid;
  width: 28px;
  height: 27px;
  place-items: center;
  border-radius: 10px;
}

.tab-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.tab-button.active {
  background: linear-gradient(135deg, #ffedf3, #f8efff);
  color: var(--pink-600);
}

.tab-button.active .tab-icon {
  color: var(--pink-500);
}

.tab-add {
  display: grid;
  width: 41px;
  height: 41px;
  place-self: center;
  place-items: center;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--pink-400), #d96689);
  box-shadow: 0 8px 20px rgba(208, 91, 129, .25);
  color: white;
}

.tab-add svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

/* Sheets and forms */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(58, 38, 47, .3);
  opacity: 0;
  visibility: hidden;
  backdrop-filter: blur(3px);
  transition: opacity .25s ease, visibility .25s ease;
}

.sheet-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.sheet {
  width: min(100%, var(--app-width));
  max-height: min(88dvh, 820px);
  overflow-y: auto;
  padding: 9px 18px calc(22px + var(--safe-bottom));
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 30px 30px 0 0;
  background: #fffafb;
  box-shadow: 0 -20px 55px rgba(66, 39, 50, .18);
  transform: translateY(100%);
  transition: transform .34s cubic-bezier(.2, .8, .2, 1);
}

.sheet-backdrop.open .sheet {
  transform: none;
}

.sheet-handle {
  width: 37px;
  height: 4px;
  margin: 0 auto 8px;
  border-radius: 99px;
  background: #eadde3;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 13px;
}

.sheet-header h3 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 21px;
}

.sheet-close {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: #f7eff2;
  color: #9a7d89;
}

.sheet-close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.sheet-content {
  padding-bottom: 2px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}

.field > label,
.field-label {
  padding-left: 3px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 650;
}

.field input,
.field select,
.field textarea,
.input-shell {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid #f0e2e8;
  outline: 0;
  border-radius: 15px;
  background: white;
  color: var(--ink);
  font-size: 13px;
  transition: border .2s, box-shadow .2s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #efabc0;
  box-shadow: 0 0 0 3px rgba(244, 154, 181, .13);
}

.field textarea {
  min-height: 80px;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #c7b5bd;
}

.input-shell {
  display: flex;
  align-items: center;
  gap: 7px;
}

.input-shell span {
  color: var(--pink-500);
  font-family: Georgia, serif;
  font-size: 15px;
}

.input-shell input {
  min-width: 0;
  min-height: 0;
  flex: 1;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: Georgia, serif;
  font-size: 24px;
}

.input-shell input:focus {
  box-shadow: none;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  padding: 4px;
  border-radius: 16px;
  background: #f9f1f4;
}

.segmented label {
  position: relative;
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented span {
  display: grid;
  min-height: 39px;
  place-items: center;
  border-radius: 12px;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 650;
  transition: background .2s, color .2s, box-shadow .2s;
}

.segmented input:checked + span {
  background: white;
  box-shadow: 0 4px 13px rgba(119, 67, 85, .08);
  color: var(--pink-600);
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.category-chips label {
  position: relative;
  cursor: pointer;
}

.category-chips input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.category-chips span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 35px;
  padding: 6px 10px;
  border: 1px solid #f1e2e8;
  border-radius: 999px;
  background: white;
  color: var(--ink-soft);
  font-size: 10px;
}

.category-chips input:checked + span {
  border-color: #f4adc2;
  background: #fff0f5;
  color: var(--pink-600);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 13px;
  border: 1px solid #f1e4e9;
  border-radius: 16px;
  background: white;
}

.switch-copy strong {
  display: block;
  font-size: 11px;
}

.switch-copy span {
  display: block;
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 8px;
}

.switch {
  position: relative;
  flex: 0 0 44px;
  width: 44px;
  height: 25px;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch i {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: #eadfe4;
  transition: background .2s;
}

.switch i::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 5px rgba(67, 41, 52, .16);
  content: "";
  transition: transform .2s;
}

.switch input:checked + i {
  background: var(--pink-400);
}

.switch input:checked + i::after {
  transform: translateX(19px);
}

.form-actions {
  display: grid;
  grid-template-columns: .75fr 1.25fr;
  gap: 9px;
  margin-top: 5px;
}

.btn {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 15px;
  border: 0;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 700;
}

.btn-secondary {
  background: #f5edf1;
  color: #876b77;
}

.btn-primary {
  background: linear-gradient(135deg, #eb819f, #d96588);
  box-shadow: 0 8px 20px rgba(208, 91, 129, .2);
  color: white;
}

.btn-mint {
  background: #568f77;
  color: white;
}

.btn-danger {
  width: 100%;
  margin-top: 10px;
  background: #fff0f3;
  color: #c14e6d;
}

.form-note {
  margin: 0 4px;
  color: var(--ink-faint);
  font-size: 9px;
  line-height: 1.5;
}

.profile-cover {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 14px;
  padding: 13px;
  border-radius: 19px;
  background: linear-gradient(120deg, #fff0f4, #f0ecff);
}

.profile-avatar {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 3px solid rgba(255, 255, 255, .8);
  border-radius: 18px;
  background: white;
  font-size: 25px;
  box-shadow: 0 5px 14px rgba(111, 67, 84, .09);
}

.profile-cover strong {
  display: block;
  font-size: 13px;
}

.profile-cover span {
  display: block;
  margin-top: 4px;
  color: var(--ink-faint);
  font-size: 9px;
}

.profile-hint {
  margin: -2px 3px 1px;
  color: var(--ink-faint);
  font-size: 9px;
  line-height: 1.5;
}

.detail-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: white;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
}

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

.detail-row span {
  color: var(--ink-faint);
}

.detail-row b {
  font-weight: 650;
  text-align: right;
}

.quick-foods {
  display: flex;
  gap: 7px;
  margin: 2px 0 3px;
  overflow-x: auto;
  scrollbar-width: none;
}

.quick-foods::-webkit-scrollbar {
  display: none;
}

.quick-food {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  padding: 7px 9px;
  border: 1px solid #f1e3e8;
  border-radius: 999px;
  background: white;
  color: var(--ink-soft);
  font-size: 9px;
}

/* Photo scan */
.scanner {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .8), rgba(255, 239, 244, .6)),
    repeating-linear-gradient(45deg, #f6ecef 0 10px, #fff9fa 10px 20px);
}

.scanner::before,
.scanner::after {
  position: absolute;
  z-index: 4;
  width: 34px;
  height: 34px;
  border-color: rgba(255, 255, 255, .92);
  border-style: solid;
  content: "";
}

.scanner::before {
  top: 16px;
  left: 16px;
  border-width: 3px 0 0 3px;
  border-radius: 10px 0 0;
}

.scanner::after {
  right: 16px;
  bottom: 16px;
  border-width: 0 3px 3px 0;
  border-radius: 0 0 10px;
}

.scanner-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 30px;
  color: #9e7d8a;
  text-align: center;
}

.scanner-empty-icon {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border: 1px solid rgba(159, 117, 134, .13);
  border-radius: 22px;
  background: rgba(255, 255, 255, .85);
  box-shadow: 0 8px 22px rgba(107, 67, 82, .08);
  font-size: 29px;
}

.scanner-empty strong {
  margin-top: 3px;
  color: var(--ink);
  font-size: 13px;
}

.scanner-empty span {
  max-width: 230px;
  font-size: 9px;
  line-height: 1.5;
}

.scanner-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-line {
  position: absolute;
  right: 20px;
  left: 20px;
  z-index: 3;
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, #fff, transparent);
  box-shadow: 0 0 15px rgba(255, 255, 255, .9);
  opacity: 0;
}

.scanner.scanning .scan-line {
  opacity: 1;
  animation: scanLine 1.3s ease-in-out infinite;
}

.scan-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 41px;
  margin-top: 9px;
  border-radius: 14px;
  background: #f9f2f5;
  color: #987a87;
  font-size: 9px;
}

.scan-status .dot-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pink-400);
  animation: pulse 1s infinite;
}

.camera-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 9px;
}

.camera-actions .btn {
  min-height: 41px;
  font-size: 10px;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 8px;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--mint);
  color: #4d8970;
  font-size: 8px;
  font-weight: 750;
}

.result-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.result-nutrient {
  padding: 9px 4px;
  border-radius: 13px;
  background: #faf4f7;
  text-align: center;
}

.result-nutrient strong {
  display: block;
  font-family: Georgia, serif;
  font-size: 16px;
}

.result-nutrient span {
  display: block;
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 7px;
}

.photo-disclaimer {
  margin: 9px 3px 0;
  color: #ae929e;
  font-size: 8px;
  line-height: 1.5;
}

/* Toast */
.toast {
  position: fixed;
  bottom: max(92px, calc(80px + var(--safe-bottom)));
  left: 50%;
  z-index: 200;
  max-width: calc(100vw - 44px);
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 999px;
  background: rgba(60, 42, 50, .9);
  box-shadow: 0 9px 25px rgba(42, 25, 32, .2);
  color: white;
  font-size: 10px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity .2s, transform .2s;
}

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

@keyframes coverReveal {
  from { opacity: .3; transform: scale(1.08); }
  to { opacity: 1; transform: scale(1.015); }
}

@keyframes viewIn {
  from { opacity: .25; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes floatSoft {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  50% { transform: translateY(-5px) rotate(-4deg); }
}

@keyframes scanLine {
  0% { top: 12%; }
  50% { top: 85%; }
  100% { top: 12%; }
}

@keyframes pulse {
  0%, 100% { opacity: .45; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1.15); }
}

@media (min-width: 600px) and (min-height: 900px) {
  .app-shell {
    height: calc(100dvh - 34px);
    border: 7px solid rgba(255, 255, 255, .74);
    border-radius: 40px;
  }

  .cover-screen {
    padding-top: 18px;
    padding-bottom: 18px;
  }
}

@media (max-width: 370px) {
  .main-content {
    padding-right: 13px;
    padding-left: 13px;
  }

  .quick-grid {
    gap: 6px;
  }

  .quick-card {
    font-size: 9px;
  }

  .nutrition-hero {
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 12px;
    padding: 15px;
  }

  .calorie-ring {
    width: 108px;
    height: 108px;
  }

  .nutrition-summary h3 {
    font-size: 18px;
  }

  .cover-bottom-card {
    align-items: center;
  }

  .cover-bottom-card p {
    max-width: 190px;
  }
}

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