:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #eef7f3;
  color: #203c33;
  font-synthesis: none;
  --ink: #203c33;
  --muted: #71877f;
  --green: #359875;
  --green-dark: #236a52;
  --green-soft: #e6f5ed;
  --line: #dce9e3;
  --paper: #ffffff;
  --surface: #f4f8f6;
  --warm: #c98143;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #eef7f3; scroll-behavior: smooth; }
body { min-width: 0; min-height: 100%; margin: 0; background: #eef7f3; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { border: 0; cursor: pointer; }
svg { display: block; }

.member-plan-app {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  background: #f8fbf9;
  box-shadow: 0 0 44px rgba(25, 73, 56, .10);
}

.member-plan-shell { width: 100%; max-width: 100%; min-width: 0; min-height: 100vh; overflow-x: hidden; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.member-plan-shell.has-app-tabbar { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }

.member-plan-shell > * { max-width: 100%; }

.member-plan-loading,
.member-plan-error {
  display: grid;
  min-height: 100vh;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.member-plan-loading span {
  width: 34px;
  height: 34px;
  border: 3px solid #d9eee5;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: loading 1s linear infinite;
}

.member-plan-loading p { margin: 0; font-size: 14px; }
.member-plan-error svg { width: 28px; color: #b96a58; }
.member-plan-error strong { font-size: 16px; }
.member-plan-error p { margin: -4px 0 0; color: #82938c; font-size: 12px; line-height: 1.5; }
.member-plan-error button { padding: 9px 16px; border-radius: 8px; background: var(--green); color: white; }

@keyframes loading { to { transform: rotate(360deg); } }

.member-plan-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  min-height: 58px;
  padding: max(8px, env(safe-area-inset-top)) 14px 8px;
  border-bottom: 1px solid rgba(214, 230, 223, .8);
  background: rgba(248, 251, 249, .94);
  backdrop-filter: blur(18px);
}

.member-plan-header > div { text-align: center; }
.member-plan-header strong { display: block; }
.member-plan-header strong { font-size: 16px; line-height: 1.2; }

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: #48685c;
  text-decoration: none;
}

.member-plan-app .icon-button {
  border-radius: 50%;
}

.icon-button svg { width: 18px; height: 18px; }

.member-plan-hero {
  position: relative;
  overflow: hidden;
  margin: 10px 12px 0;
  padding: 22px 18px 20px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 88% 14%, rgba(255, 255, 255, .72) 0 48px, transparent 49px),
    linear-gradient(135deg, #e0f4e8 0%, #eff8e9 56%, #fff4df 100%);
}

.member-plan-hero::after {
  position: absolute;
  right: -20px;
  bottom: -30px;
  width: 120px;
  height: 120px;
  border: 22px solid rgba(71, 158, 117, .08);
  border-radius: 50%;
  content: "";
}

.member-plan-hero-copy { position: relative; z-index: 1; }
.member-plan-hero h1 { margin: 0; color: #174d3a; font-size: 25px; line-height: 1.2; letter-spacing: 0; }
.member-plan-hero p { max-width: 325px; margin: 12px 0 0; color: #59736a; font-size: 12px; line-height: 1.7; }

.plan-ai-guide {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  margin: 9px 12px 0;
  padding: 10px;
  border: 1px solid #cfe4da;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 5px 15px rgba(39, 92, 72, .04);
}

.plan-ai-guide > span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e6f5ed;
  color: #359875;
}

.plan-ai-guide > span svg { width: 19px; height: 19px; }
.plan-ai-guide > div { min-width: 0; }
.plan-ai-guide strong { display: block; color: #285243; font-size: 12px; line-height: 1.3; }
.plan-ai-guide p { margin: 3px 0 0; color: #7c9088; font-size: 9.5px; line-height: 1.4; }
.plan-ai-guide button {
  min-height: 34px;
  padding: 0 11px;
  border-radius: 8px;
  background: #359875;
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 800;
}

.year-path,
.stage-detail,
.action-section,
.menu-section { padding: 22px 14px 0; scroll-margin-top: 66px; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.section-heading > div { display: grid; min-width: 0; gap: 5px; }
.section-heading span, .section-heading h2 { display: block; }
.section-heading span { color: #71877f; font-size: 12px; font-weight: 500; }
.section-heading h2 { margin: 0; color: var(--ink); font-size: 17px; line-height: 1.3; letter-spacing: 0; }
.section-heading > small { flex: 0 0 auto; color: #8ba098; font-size: 11px; }
.section-heading > svg { width: 21px; height: 21px; color: #64aa8c; }
.section-heading.compact { margin-bottom: 10px; }

.member-plan-app .section-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.member-plan-app .section-heading > div { display: grid; min-width: 0; gap: 5px; }
.member-plan-app .section-heading span { color: #71877f; font-size: 12px; font-weight: 500; }
.member-plan-app .section-heading h2 { margin: 0; color: var(--ink); font-size: 17px; line-height: 1.3; letter-spacing: 0; }
.member-plan-app .section-heading.compact { margin-bottom: 10px; }

.plan-content-switcher {
  padding: 16px 14px 0;
  scroll-margin-top: 66px;
}

.plan-content-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf3f0;
}

.plan-content-tabs button {
  min-width: 0;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 6px;
  background: transparent;
  color: #71877f;
  font-size: 12px;
  font-weight: 750;
}

.plan-content-tabs button svg { width: 15px; height: 15px; }
.plan-content-tabs button.active {
  background: #ffffff;
  color: var(--green-dark);
  box-shadow: 0 3px 9px rgba(39, 90, 71, .08);
}

.plan-content-body { min-height: 390px; }
.plan-content-body > .stage-detail,
.plan-content-body > .action-section,
.plan-content-body > .menu-section {
  padding: 14px 0 0;
}

.stage-rail { display: flex; gap: 8px; overflow-x: auto; padding: 1px 1px 8px; scrollbar-width: none; scroll-snap-type: x proximity; }
.stage-rail::-webkit-scrollbar { display: none; }
.stage-chip { display: grid; width: 92px; min-height: 66px; flex: 0 0 92px; align-content: center; gap: 5px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--muted); text-align: left; scroll-snap-align: center; }
.stage-chip span { color: #879b93; font-size: 10px; }
.stage-chip strong { color: #49665c; font-size: 13px; line-height: 1.25; font-weight: 750; }
.stage-chip.active { border-color: #5eb58f; background: var(--green-soft); box-shadow: 0 6px 14px rgba(42, 130, 94, .10); }
.stage-chip.active span, .stage-chip.active strong { color: var(--green-dark); }

.stage-detail { padding-top: 12px; }

.stage-focus { display: flex; align-items: flex-start; gap: 10px; padding: 13px; border-left: 3px solid #4aa17d; border-radius: 0 8px 8px 0; background: #edf7f2; }
.stage-focus > svg { width: 19px; height: 19px; flex: 0 0 auto; color: var(--green); }
.stage-focus h3 { margin: 0; color: var(--green-dark); font-size: 15px; line-height: 1.3; }
.stage-focus p { margin: 5px 0 0; color: #3f5e53; font-size: 12px; line-height: 1.75; }

.stage-story { padding: 18px 1px 4px; }
.content-title { display: flex; align-items: center; gap: 7px; }
.content-title svg { width: 18px; height: 18px; color: var(--warm); }
.content-title h3 { margin: 0; color: #2d4b41; font-size: 15px; }
.stage-story > p { margin: 5px 0 0; color: #657a72; font-size: 12px; line-height: 1.75; }

.mechanism-panel { margin-top: 8px; padding: 14px 1px 4px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.mechanism-panel .content-title svg { color: var(--green); }
.mechanism-panel > p { margin: 5px 0 0; padding: 0 0 14px; color: #657a72; font-size: 12px; line-height: 1.75; }

.action-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.action-list li { display: grid; grid-template-columns: 34px 1fr; align-items: start; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.action-list li > span { color: #64a98b; font-size: 11px; font-weight: 800; }
.action-list p { margin: 0; color: #516b61; font-size: 12px; line-height: 1.65; }

.meal-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin-top: 2px; }
.meal-tab { display: grid; min-width: 0; min-height: 62px; place-items: center; align-content: center; gap: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: #788d85; }
.meal-tab svg { width: 18px; height: 18px; }
.meal-tab span { font-size: 12px; }
.meal-tab small { font-size: 9px; opacity: .72; }
.meal-tab.active { border-color: #59b58c; background: var(--green-soft); color: var(--green-dark); box-shadow: 0 5px 12px rgba(44, 135, 96, .09); }

.dish-list { display: grid; gap: 8px; margin-top: 10px; }
.dish-detail { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.dish-detail > summary { display: grid; grid-template-columns: 82px minmax(0, 1fr) 16px; align-items: center; gap: 10px; padding: 9px; cursor: pointer; list-style: none; }
.dish-detail > summary::-webkit-details-marker { display: none; }
.dish-placeholder { display: grid; min-height: 82px; place-content: center; justify-items: center; gap: 6px; border-radius: 6px; color: #437662; }
.dish-placeholder.mint { background: #e1f3e9; }
.dish-placeholder.amber { background: #f8edd8; color: #9a6737; }
.dish-placeholder.blue { background: #e5f0f2; color: #4e7780; }
.dish-placeholder.rose { background: #f7e9e5; color: #9a675a; }
.dish-placeholder svg { width: 24px; height: 24px; }
.dish-placeholder span { font-size: 9px; opacity: .76; }
.dish-copy { min-width: 0; }
.dish-copy h3 { margin: 0 0 5px; color: var(--ink); font-size: 16px; line-height: 1.3; }
.dish-copy p { display: -webkit-box; overflow: hidden; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 1; }
.dish-copy p + p { margin-top: 3px; }
.dish-copy b { color: #263c34; font-size: inherit; font-weight: 800; }
.dish-copy .dish-value { color: #b87643; }
.dish-chevron { width: 16px; height: 16px; color: #96aaa2; transition: transform .2s ease; }
.dish-detail[open] .dish-chevron { transform: rotate(180deg); }
.dish-detail .recipe-method { padding: 12px 13px 14px; border-top: 1px solid var(--line); background: #fbfdfc; }
.dish-detail .recipe-method > strong { color: #315b4c; font-size: 14px; }
.dish-detail .recipe-method ol { display: grid; gap: 8px; margin: 8px 0 0; padding-left: 20px; }
.dish-detail .recipe-method li { padding-left: 2px; color: #61756d; font-size: 12px; line-height: 1.65; }

.plan-recipe-ai {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #cfe3da;
  border-radius: 8px;
  background: #edf7f2;
}

.plan-recipe-ai > div:first-child {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
}

.plan-recipe-ai > div:first-child > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  color: var(--green);
}

.plan-recipe-ai > div:first-child > span svg { width: 18px; height: 18px; }
.plan-recipe-ai strong { display: block; color: #285243; font-size: 12px; line-height: 1.35; }
.plan-recipe-ai p { margin: 3px 0 0; color: #748a81; font-size: 10px; line-height: 1.5; }
.plan-recipe-ai > div:last-child { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 10px; }
.plan-recipe-ai button {
  min-height: 37px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid #bcdaca;
  border-radius: 8px;
  background: #ffffff;
  color: #397d61;
  font-size: 10.5px;
  font-weight: 800;
}
.plan-recipe-ai button:last-child { border-color: #3e9370; background: #3e9370; color: #ffffff; }
.plan-recipe-ai button svg { width: 15px; height: 15px; }

.plan-inline-ai {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr) 17px;
  align-items: center;
  gap: 9px;
  margin-top: 13px;
  padding: 7px 11px;
  border-radius: 8px;
  background: #286b56;
  color: #ffffff;
  text-align: left;
}

.plan-inline-ai > span {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(255,255,255,.14);
}
.plan-inline-ai svg { width: 16px; height: 16px; }
.plan-inline-ai strong { font-size: 11.5px; line-height: 1.3; }

.member-plan-footer { display: flex; align-items: flex-start; gap: 8px; margin: 20px 14px 0; padding: 13px; border-radius: 8px; background: #edf3f0; color: #74877f; }
.member-plan-footer svg { width: 16px; height: 16px; flex: 0 0 auto; color: #719988; }
.member-plan-footer p { margin: 0; font-size: 10px; line-height: 1.6; }

.member-plan-app .app-tabbar {
  position: fixed;
  right: auto;
  bottom: 0;
  left: 50%;
  width: min(100%, 430px);
  padding-bottom: env(safe-area-inset-bottom);
  transform: translateX(-50%);
}

@media (max-width: 360px) {
  .member-plan-hero { margin-inline: 8px; padding-inline: 14px; }
  .year-path { padding-inline: 10px; }
  .plan-content-switcher { padding-inline: 10px; }
  .plan-ai-guide { margin-inline: 8px; }
  .dish-detail > summary { grid-template-columns: 72px minmax(0, 1fr) 14px; gap: 8px; }
  .dish-placeholder { min-height: 76px; }
}

@media (min-width: 700px) {
  body.member-plan-standalone { padding: 24px 0; }
  .member-plan-app { min-height: calc(100vh - 48px); border: 1px solid #dce9e3; border-radius: 8px; overflow: clip; }
  .member-plan-header { top: 0; }
}

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