:root {
  color-scheme: light;
  --bg: #fff7ed;
  --surface: #ffffff;
  --ink: #24211f;
  --muted: #746b64;
  --line: #eadbcb;
  --mint: #1f8a70;
  --mint-soft: #dff4ea;
  --tomato: #e35d45;
  --tomato-soft: #ffe1d9;
  --sun: #f7b733;
  --sun-soft: #fff0c8;
  --berry: #7c4d8b;
  --sky: #d9f1ff;
  --shadow: 0 18px 38px rgba(111, 74, 37, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, #fff2df 0, #fff8ef 260px, #f7fbf6 100%),
    var(--bg);
  color: var(--ink);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
input,
select {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

button {
  cursor: pointer;
  padding: 0 16px;
  font-weight: 900;
}

button:hover,
a:hover {
  transform: translateY(-1px);
}

input,
select {
  width: 100%;
  padding: 10px 12px;
}

.app-shell {
  width: min(1120px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

.hero {
  display: none;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 18px;
  padding: 10px 0 14px;
}

.eyebrow,
.small-label {
  margin: 0;
  color: var(--mint);
  font-size: 13px;
  font-weight: 900;
}

.hero h1 {
  margin: 5px 0 0;
  font-size: clamp(30px, 7vw, 58px);
  line-height: 1.02;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 620px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.45;
}

.plan-card,
.family-score,
.member-card,
.source-note,
.drawer {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.plan-card {
  width: min(290px, 100%);
  padding: 14px;
  display: grid;
  gap: 9px;
  font-weight: 900;
}

.plan-card strong {
  font-size: 26px;
}

.meter-track {
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: #f0dfcf;
}

.meter-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--sun));
  transition: width 180ms ease;
}

.home-board {
  display: grid;
  gap: 14px;
}

.family-score {
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(247, 183, 51, 0.24), rgba(31, 138, 112, 0.14)),
    var(--surface);
}

.family-score > strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(42px, 11vw, 76px);
  line-height: 0.96;
}

.family-score p {
  margin: 12px 0;
  font-size: clamp(17px, 3.6vw, 24px);
  font-weight: 900;
  line-height: 1.35;
}

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

.score-row span {
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.score-row b {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 17px;
}

.member-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-height: min(58vh, 560px);
  align-items: stretch;
}

.avatar-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.avatar-card.is-selected {
  outline: 3px solid rgba(31, 138, 112, 0.25);
}

.avatar-button {
  width: 100%;
  min-height: 360px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  border: 0;
  background: linear-gradient(180deg, #fff8ef, #ffffff);
  text-align: center;
}

.avatar-card.is-wife .avatar-button {
  background: linear-gradient(180deg, #ffe1d9, #fff8ef);
}

.avatar-card.is-husband .avatar-button {
  background: linear-gradient(180deg, #d9f1ff, #fff8ef);
}

.avatar-figure,
.detail-avatar {
  position: relative;
  width: 160px;
  height: 220px;
  display: block;
}

.avatar-head,
.avatar-body,
.avatar-arms,
.avatar-legs {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: block;
}

.avatar-head {
  top: 0;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: #24211f;
}

.avatar-body {
  top: 86px;
  width: 104px;
  height: 92px;
  border-radius: 46px 46px 24px 24px;
  background: var(--mint);
}

.is-wife .avatar-body,
.detail-hero.wife .avatar-body {
  background: var(--tomato);
}

.avatar-arms {
  top: 102px;
  width: 156px;
  height: 28px;
  border-radius: 999px;
  background: rgba(36, 33, 31, 0.28);
}

.avatar-legs {
  top: 172px;
  width: 96px;
  height: 42px;
  border-radius: 0 0 30px 30px;
  border-left: 28px solid #24211f;
  border-right: 28px solid #24211f;
}

.avatar-figure.is-over .avatar-body {
  background: var(--sun);
}

.avatar-card .member-name {
  font-size: clamp(30px, 6vw, 48px);
}

.chibi-avatar {
  animation: chibi-bob 2.6s ease-in-out infinite;
  filter: drop-shadow(0 14px 18px rgba(70, 45, 30, 0.14));
}

.chibi-avatar .avatar-head {
  z-index: 3;
  top: 8px;
  width: 112px;
  height: 104px;
  border: 5px solid #2d2522;
  border-radius: 48% 48% 44% 44%;
  background:
    radial-gradient(circle at 30% 66%, rgba(255, 123, 114, 0.42) 0 8px, transparent 9px),
    radial-gradient(circle at 70% 66%, rgba(255, 123, 114, 0.42) 0 8px, transparent 9px),
    linear-gradient(180deg, #fff4df 0%, #ffd9b6 100%);
}

.chibi-avatar .avatar-head::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 42px;
  width: 16px;
  height: 18px;
  border-radius: 50%;
  background: #2d2522;
  box-shadow: 52px 0 0 #2d2522;
  animation: chibi-blink 4.2s infinite;
}

.chibi-avatar .avatar-head::after {
  content: "";
  position: absolute;
  left: 42px;
  top: 68px;
  width: 28px;
  height: 14px;
  border-bottom: 4px solid #2d2522;
  border-radius: 0 0 999px 999px;
}

.chibi-avatar .avatar-body {
  z-index: 2;
  top: 108px;
  width: 118px;
  height: 94px;
  border: 5px solid #2d2522;
  border-radius: 36px 36px 42px 42px;
  background: linear-gradient(160deg, var(--mint), #79d8b5);
}

.is-wife .chibi-avatar .avatar-body,
.detail-hero.wife .chibi-avatar .avatar-body {
  background: linear-gradient(160deg, #ff7a66, #ffd166);
}

.is-husband .chibi-avatar .avatar-body,
.detail-hero.husband .chibi-avatar .avatar-body {
  background: linear-gradient(160deg, #4aa3df, #8ee3f5);
}

.chibi-avatar .avatar-body::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 18px;
  width: 34px;
  height: 34px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
}

.chibi-avatar .avatar-arms {
  z-index: 1;
  top: 128px;
  width: 150px;
  height: 32px;
  border: 5px solid #2d2522;
  border-radius: 999px;
  background: #ffe0bd;
  animation: chibi-wave 1.8s ease-in-out infinite;
}

.chibi-avatar .avatar-legs {
  z-index: 0;
  top: 190px;
  width: 82px;
  height: 40px;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(90deg, #2d2522 0 24px, transparent 24px 58px, #2d2522 58px 82px);
}

.chibi-avatar .avatar-shadow {
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 128px;
  height: 22px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(45, 37, 34, 0.13);
}

.avatar-sparkle {
  position: absolute;
  z-index: 4;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: #f7b733;
  transform: rotate(45deg);
  animation: sparkle-pop 2.4s ease-in-out infinite;
}

.sparkle-one {
  top: 16px;
  right: 8px;
}

.sparkle-two {
  left: 12px;
  top: 88px;
  width: 10px;
  height: 10px;
  background: #7c4d8b;
  animation-delay: 0.8s;
}

.is-wife .chibi-avatar .avatar-head::before,
.detail-hero.wife .chibi-avatar .avatar-head::before {
  box-shadow: 52px 0 0 #2d2522, 26px -37px 0 13px #7c4d8b;
}

.is-husband .chibi-avatar .avatar-head::before,
.detail-hero.husband .chibi-avatar .avatar-head::before {
  box-shadow: 52px 0 0 #2d2522, -10px -32px 0 10px #2d2522, 62px -32px 0 10px #2d2522;
}

@keyframes chibi-bob {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

@keyframes chibi-blink {
  0%,
  88%,
  100% {
    transform: scaleY(1);
  }

  92% {
    transform: scaleY(0.12);
  }
}

@keyframes chibi-wave {
  0%,
  100% {
    transform: translateX(-50%) rotate(-3deg);
  }

  50% {
    transform: translateX(-50%) rotate(4deg);
  }
}

@keyframes sparkle-pop {
  0%,
  100% {
    opacity: 0.35;
    transform: rotate(45deg) scale(0.7);
  }

  50% {
    opacity: 1;
    transform: rotate(45deg) scale(1.08);
  }
}

@keyframes detail-chibi-bob {
  0%,
  100% {
    transform: scale(0.62) translateY(0);
  }

  50% {
    transform: scale(0.62) translateY(-8px);
  }
}

.avatar-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.avatar-stats span {
  padding: 11px;
  border-radius: 8px;
  background: #fff8ef;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.avatar-stats b {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 17px;
}

.member-top,
.reminder-head,
.log-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.member-name,
.section-head h2 {
  margin: 3px 0 0;
  font-size: 22px;
  line-height: 1.12;
}

.member-detail {
  scroll-margin-top: 80px;
}

.detail-shell {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.detail-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border-radius: 8px;
  background: #d9f1ff;
}

.detail-hero.wife {
  background: #ffe1d9;
}

.detail-hero h2 {
  margin: 4px 0;
  font-size: clamp(28px, 5vw, 44px);
}

.detail-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  font-weight: 900;
  line-height: 1.45;
}

.detail-avatar {
  width: 98px;
  height: 132px;
  transform: scale(0.62);
  transform-origin: left center;
}

.detail-avatar.chibi-avatar {
  animation: detail-chibi-bob 2.6s ease-in-out infinite;
}

.detail-stats,
.detail-grid-layout {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.detail-stats span {
  padding: 12px;
  border-radius: 8px;
  background: #fff8ef;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.detail-stats b {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 18px;
}

.detail-grid-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.photo-feed,
.detail-list,
.comment-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.food-tile,
.detail-row,
.comment-item {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.food-tile {
  grid-template-columns: 86px 1fr;
  align-items: center;
}

.food-photo {
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: var(--tomato-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

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

.food-tile strong,
.detail-row strong {
  font-size: 17px;
}

.food-tile span,
.detail-row span,
.comment-item span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.comment-box {
  display: grid;
  gap: 10px;
}

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

.comment-form .primary-action {
  width: auto;
  min-width: 120px;
}

.comment-item p {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.45;
}

.daily-status {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--sun-soft);
  color: #805500;
  font-size: 13px;
}

.banter {
  min-height: 44px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.45;
}

.big-number {
  padding: 13px;
  border-radius: 8px;
  background: var(--mint-soft);
}

.big-number span,
.core-grid span,
.detail-grid,
.log-meta,
label,
.form-hint {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.big-number strong {
  display: block;
  margin-top: 4px;
  color: var(--mint);
  font-size: clamp(28px, 7vw, 42px);
  line-height: 1;
}

.core-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.core-grid div {
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  background: #fff8ef;
}

.core-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 17px;
  line-height: 1.1;
}

.mini-detail {
  margin-top: 12px;
}

.mini-detail summary {
  cursor: pointer;
  color: var(--berry);
  font-weight: 900;
}

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

.detail-grid span {
  padding: 9px;
  border-radius: 8px;
  background: var(--sky);
}

.mini-chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 6px;
  height: 78px;
  margin-top: 10px;
  padding: 8px;
  border-radius: 8px;
  background: #f7faf8;
}

.mini-bar {
  min-width: 0;
  border-radius: 6px 6px 2px 2px;
  background: var(--mint);
}

.mini-bar.over {
  background: var(--tomato);
}

.quick-actions {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
  padding: 8px 0;
  background: rgba(255, 248, 239, 0.9);
  backdrop-filter: blur(12px);
}

.quick-actions a {
  min-height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--tomato);
  color: #fff;
  text-decoration: none;
  font-weight: 900;
  box-shadow: 0 10px 18px rgba(227, 93, 69, 0.2);
}

.quick-actions a:nth-child(2) {
  background: var(--mint);
}

.quick-actions a:nth-child(3) {
  background: var(--berry);
}

.source-note {
  padding: 14px;
  margin-bottom: 14px;
  background: #fffbeb;
}

.source-note p {
  margin: 7px 0 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.5;
}

.drawer-stack {
  display: grid;
  gap: 12px;
}

.drawer {
  overflow: hidden;
}

.drawer > summary {
  cursor: pointer;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px;
  list-style: none;
}

.drawer > summary::-webkit-details-marker {
  display: none;
}

.drawer > summary::after {
  content: "+";
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--sun-soft);
  color: #805500;
  font-size: 22px;
  font-weight: 900;
}

.drawer[open] > summary::after {
  content: "-";
}

.drawer b {
  font-size: 18px;
}

.drawer small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 800;
}

form,
.log-layout,
.reminder-list,
.reminder-head,
.poster-tools,
.poster-stage,
.ghost-action {
  margin: 0 15px 15px;
}

.form-head {
  display: grid;
  grid-template-columns: minmax(0, 260px);
  margin-bottom: 12px;
}

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

label {
  display: grid;
  gap: 6px;
}

.span-2 {
  grid-column: span 2;
}

.primary-action,
.ghost-action {
  border: 0;
  background: var(--mint);
  color: #fff;
}

.primary-action {
  width: 100%;
}

.ghost-action {
  width: calc(100% - 30px);
  background: #fff;
  color: var(--tomato);
  border: 1px solid var(--tomato-soft);
}

.photo-drop {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 190px;
  overflow: hidden;
  border: 2px dashed #d8b996;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(247, 183, 51, 0.16), rgba(31, 138, 112, 0.1)),
    #fffaf4;
  color: var(--tomato);
  text-align: center;
}

.photo-drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.photo-drop img {
  width: 100%;
  height: 100%;
  max-height: 260px;
  object-fit: cover;
}

.watch-drop {
  min-height: 150px;
  border-color: #9bc7df;
  background:
    linear-gradient(135deg, rgba(124, 77, 139, 0.12), rgba(31, 138, 112, 0.1)),
    #f7fbff;
}

.ai-panel {
  display: grid;
  grid-template-columns: minmax(0, 240px) 1fr;
  align-items: center;
  gap: 10px;
  margin: 12px 0 0;
}

.ai-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.inline-action {
  width: 100%;
  margin: 0;
}

.watch-proof {
  width: 74px;
  height: 74px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--sky);
}

.watch-proof img,
.watch-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.exercise-proof-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.watch-thumb {
  background: var(--sky);
}

#photoHint {
  padding: 10px 13px;
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow);
  font-weight: 900;
}

.form-hint {
  margin: -4px 0 12px;
  line-height: 1.45;
}

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

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

.empty {
  padding: 14px;
  border-radius: 8px;
  background: #fff8ef;
  color: var(--muted);
  font-weight: 800;
}

.log-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.log-thumb {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--tomato-soft);
}

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

.log-title {
  margin: 0;
  font-weight: 900;
}

.log-kcal {
  flex: 0 0 auto;
  color: var(--mint);
  font-size: 20px;
  font-weight: 900;
}

.reminder-list {
  display: grid;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.reminder-list li {
  padding: 12px;
  border-radius: 8px;
  background: var(--sky);
  font-weight: 900;
}

.poster-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.poster-tools .ghost-action {
  width: 100%;
  margin: 0;
}

.poster-tools .ghost-action:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.poster-stage {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 14px;
  border-radius: 8px;
  background: #fff8ef;
}

.poster-stage img {
  width: min(100%, 360px);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.poster-stage p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.45;
  text-align: center;
}

.danger-text {
  color: var(--tomato) !important;
}

@media (max-width: 860px) {
  .hero,
  .member-grid,
  .log-layout,
  .detail-grid-layout {
    grid-template-columns: 1fr;
  }

  .plan-card {
    width: 100%;
  }

  .member-grid {
    min-height: auto;
  }

  .detail-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 18px, 1120px);
    padding-top: 10px;
  }

  .score-row,
  .core-grid,
  .avatar-stats,
  .detail-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .avatar-button {
    min-height: 300px;
  }

  .avatar-figure {
    transform: scale(0.85);
  }

  .detail-hero {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .food-tile,
  .comment-form {
    grid-template-columns: 1fr;
  }

  .food-photo {
    width: 100%;
    height: 180px;
  }

  .quick-actions {
    margin-left: -2px;
    margin-right: -2px;
  }

  .form-grid,
  .form-head,
  .poster-tools,
  .ai-panel {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .member-top,
  .log-item,
  .log-main,
  .reminder-head {
    align-items: stretch;
    flex-direction: column;
  }

  .daily-status,
  .reminder-head button {
    width: 100%;
    text-align: center;
  }
}
