:root {
  --bg: #f7fbf7;
  --paper: #ffffff;
  --ink: #203025;
  --muted: #657466;
  --line: #dce7dd;
  --green: #26734d;
  --green-soft: #e4f3e9;
  --orange: #b55d23;
  --orange-soft: #fff0df;
  --red: #b64236;
  --yellow-soft: #fff8d9;
  --blue-soft: #eaf4ff;
  --shadow: 0 16px 36px rgba(34, 58, 42, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.55;
  padding-bottom: env(safe-area-inset-bottom);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 34px 24px 18px;
}

.brand {
  padding: 28px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 12% 16%, rgba(255, 240, 184, 0.3), transparent 26%),
    radial-gradient(circle at 82% 22%, rgba(255, 255, 255, 0.2), transparent 28%),
    linear-gradient(135deg, #1f6f49, #4d8f57 48%, #b46a2a);
  color: #fff;
  min-height: 230px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.eyebrow {
  margin: 0 0 6px;
  color: inherit;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.18;
}

h1 {
  font-size: clamp(38px, 6vw, 72px);
}

h2 {
  font-size: 28px;
}

h3 {
  font-size: 24px;
}

.subtitle {
  max-width: 680px;
  margin: 14px 0 0;
  font-size: 22px;
}

.today-card,
.quick-panel,
.shopping-panel,
.guide-panel,
.pantry-panel,
.source-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.today-card {
  padding: 24px;
  align-self: stretch;
}

.reminder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.today-card span {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--yellow-soft);
  color: #775d08;
  font-weight: 800;
  font-size: 15px;
}

.today-card strong {
  display: block;
  margin-top: 18px;
  font-size: 28px;
  line-height: 1.25;
}

.today-card p {
  color: var(--muted);
}

.quiet {
  color: var(--green);
  padding: 6px 0;
}

.reminder-list {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.reminder-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  color: var(--muted);
  font-size: 16px;
}

.reminder-item b {
  color: var(--ink);
}

main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px 48px;
}

.quick-panel {
  padding: 22px;
  margin: 18px 0;
}

.guide-panel,
.pantry-panel,
.source-panel {
  padding: 22px;
  margin: 18px 0;
}

.guide-grid,
.pantry-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.source-panel {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.source-panel p:last-child {
  margin: 0;
  color: var(--muted);
}

.guide-grid article,
.pantry-grid div {
  min-height: 138px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.guide-grid strong,
.pantry-grid b {
  display: block;
  margin-bottom: 8px;
  color: var(--green);
  font-size: 20px;
}

.guide-grid p,
.pantry-grid span {
  margin: 0;
  color: var(--muted);
}

.section-heading,
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading .eyebrow,
.panel-header .eyebrow {
  color: var(--green);
}

.daily-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.meal-card {
  min-height: 160px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.meal-card span {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--orange);
  font-weight: 800;
}

.meal-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

.meal-card ul {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 16px;
}

.daily-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.primary-button,
.soft-button,
.ghost-button,
.copy-button {
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  font-weight: 800;
}

.primary-button,
.copy-button {
  background: var(--green);
  color: #fff;
}

.soft-button {
  background: var(--green-soft);
  color: var(--green);
}

.ghost-button {
  background: var(--orange-soft);
  color: var(--orange);
}

.tools {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 14px 0;
  background: rgba(247, 251, 247, 0.95);
  backdrop-filter: blur(12px);
}

.search-box {
  display: block;
  margin-bottom: 12px;
}

.search-box span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-weight: 800;
}

.search-box input {
  width: 100%;
  min-height: 58px;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.search-box input:focus {
  border-color: var(--green);
}

.tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.tab {
  flex: 0 0 auto;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.tab.active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.content-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.shopping-panel {
  position: sticky;
  top: 154px;
  padding: 18px;
}

.shopping-header {
  flex-direction: row;
  align-items: center;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--red);
  font-weight: 800;
}

.shopping-header .text-button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #fff1ee;
}

.shopping-list {
  margin: 16px 0;
}

.shopping-list.empty {
  color: var(--muted);
}

.shopping-group {
  margin: 14px 0;
}

.shopping-group strong {
  display: block;
  margin-bottom: 6px;
  color: var(--green);
}

.shopping-group ul {
  margin: 0;
  padding-left: 22px;
}

.copy-button {
  width: 100%;
}

.recipes-section {
  min-width: 0;
}

.compact {
  margin: 10px 0 16px;
}

.count {
  color: var(--muted);
  font-weight: 800;
}

.recipe-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.compact-button {
  min-height: 42px;
  padding: 8px 13px;
}

.masonry {
  columns: 3 240px;
  column-gap: 16px;
}

.recipe-card {
  break-inside: avoid;
  display: inline-block;
  width: 100%;
  margin: 0 0 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(34, 58, 42, 0.08);
}

.food-visual {
  position: relative;
  min-height: 118px;
  padding: 14px;
  color: #fff;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
}

.food-visual span {
  position: relative;
  z-index: 2;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  font-size: 15px;
  font-weight: 800;
}

.food-art {
  position: absolute;
  right: 12px;
  bottom: 10px;
  width: 128px;
  height: 96px;
  color: rgba(255, 255, 255, 0.95);
  transform: scale(0.86);
  transform-origin: right bottom;
}

.food-art .bowl {
  position: absolute;
  left: 20px;
  bottom: 12px;
  width: 110px;
  height: 54px;
  border-radius: 0 0 58px 58px;
  background: rgba(255, 255, 255, 0.9);
}

.food-art .bowl::before {
  content: "";
  position: absolute;
  left: -7px;
  right: -7px;
  top: -15px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 248, 217, 0.95);
  border: 5px solid rgba(255, 255, 255, 0.72);
}

.food-art .steam,
.food-art .steam::before,
.food-art .steam::after {
  position: absolute;
  content: "";
  width: 10px;
  height: 32px;
  border-radius: 999px;
  border-left: 4px solid rgba(255, 255, 255, 0.62);
  top: 4px;
}

.food-art .steam {
  left: 58px;
}

.food-art .steam::before {
  left: 24px;
  top: 4px;
}

.food-art .steam::after {
  left: 48px;
  top: 1px;
}

.food-art .leaf,
.food-art .leaf::before,
.food-art .leaf::after {
  position: absolute;
  content: "";
  border-radius: 70% 0 70% 0;
  background: #d9f2bd;
}

.food-art .leaf {
  width: 34px;
  height: 18px;
  right: 30px;
  bottom: 54px;
  transform: rotate(-18deg);
}

.food-art .leaf::before {
  width: 30px;
  height: 16px;
  right: 32px;
  top: 9px;
  transform: rotate(35deg);
}

.food-art .leaf::after {
  width: 28px;
  height: 15px;
  right: 62px;
  top: 22px;
  transform: rotate(-8deg);
}

.food-art .egg,
.food-art .tomato,
.food-art .cube,
.food-art .fish,
.food-art .cake,
.food-art .noodle,
.food-art .cup {
  position: absolute;
}

.food-art .egg {
  width: 28px;
  height: 22px;
  border-radius: 50%;
  background: #fff7cf;
  left: 50px;
  bottom: 62px;
}

.food-art .egg::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e2a843;
  left: 9px;
  top: 6px;
}

.food-art .tomato {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f27c4f;
  left: 76px;
  bottom: 58px;
}

.food-art .cube {
  width: 24px;
  height: 22px;
  border-radius: 5px;
  background: #fff3cb;
  left: 72px;
  bottom: 58px;
  box-shadow: 30px 8px 0 #fff3cb;
}

.food-art .fish {
  width: 78px;
  height: 34px;
  border-radius: 50%;
  background: #eaf4ff;
  left: 38px;
  bottom: 50px;
}

.food-art .fish::before {
  content: "";
  position: absolute;
  right: -22px;
  top: 7px;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 26px solid #eaf4ff;
}

.food-art .fish::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2d6f87;
}

.food-art .cake {
  width: 100px;
  height: 22px;
  border-radius: 999px;
  background: #fff0df;
  left: 26px;
  bottom: 54px;
  box-shadow: 0 18px 0 rgba(255, 240, 223, 0.85);
}

.food-art .noodle {
  width: 84px;
  height: 42px;
  left: 34px;
  bottom: 48px;
  border-radius: 50%;
  border-top: 6px solid #fff0df;
  border-bottom: 6px solid #fff0df;
}

.food-art .noodle::before,
.food-art .noodle::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  height: 6px;
  border-radius: 999px;
  background: #fff0df;
}

.food-art .noodle::before {
  top: 9px;
}

.food-art .noodle::after {
  bottom: 9px;
}

.food-art .cup {
  width: 72px;
  height: 70px;
  border-radius: 10px 10px 28px 28px;
  background: rgba(255, 255, 255, 0.9);
  left: 40px;
  bottom: 12px;
}

.food-art .cup::before {
  content: "";
  position: absolute;
  right: -23px;
  top: 16px;
  width: 28px;
  height: 30px;
  border: 7px solid rgba(255, 255, 255, 0.78);
  border-left: 0;
  border-radius: 0 22px 22px 0;
}

.recipe-info {
  padding: 16px;
}

.recipe-info p {
  margin: 9px 0;
  color: var(--muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0;
}

.tag {
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 14px;
  font-weight: 800;
}

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

.small-button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.small-button.featured {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.recipe-dialog {
  width: min(780px, calc(100vw - 24px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}

.recipe-dialog::backdrop {
  background: rgba(8, 19, 12, 0.56);
}

.dialog-body {
  position: relative;
  max-height: min(86vh, 920px);
  overflow: auto;
  background: #fff;
}

.close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 34px;
  line-height: 1;
}

.dialog-hero {
  min-height: 172px;
  padding: 24px;
  color: #fff;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
}

.dialog-hero h2 {
  position: relative;
  z-index: 2;
  font-size: 38px;
  max-width: 620px;
}

.dialog-hero .food-art {
  position: relative;
  right: auto;
  bottom: auto;
  flex: 0 0 140px;
  transform: scale(0.9);
  transform-origin: right bottom;
}

.dialog-content {
  padding: 24px;
}

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

.detail-grid.wide {
  grid-template-columns: 1fr;
  margin-top: 16px;
}

.detail-box {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.detail-box h3 {
  margin-bottom: 10px;
  color: var(--green);
}

.detail-box ul,
.detail-box ol {
  margin: 0;
  padding-left: 24px;
}

.detail-box li {
  margin: 7px 0;
}

.warning {
  margin-top: 16px;
  padding: 16px;
  border-radius: 8px;
  background: var(--yellow-soft);
  color: #5a4814;
  font-weight: 700;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  max-width: calc(100vw - 32px);
  padding: 13px 18px;
  border-radius: 999px;
  background: #203025;
  color: #fff;
  font-weight: 800;
  transition: 0.2s ease;
}

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

.mobile-nav {
  display: none;
}

@media (max-width: 940px) {
  .topbar,
  .content-layout {
    grid-template-columns: 1fr;
  }

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

  .source-panel {
    grid-template-columns: 1fr;
  }

  .shopping-panel {
    position: static;
  }

  .daily-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .tools {
    position: static;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 18px;
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .topbar,
  main {
    padding-left: 14px;
    padding-right: 14px;
  }

  .brand {
    min-height: 210px;
    padding: 20px;
  }

  h1 {
    font-size: 42px;
  }

  h2 {
    font-size: 25px;
  }

  h3 {
    font-size: 22px;
  }

  .subtitle {
    font-size: 18px;
  }

  .today-card,
  .quick-panel,
  .shopping-panel,
  .guide-panel,
  .pantry-panel,
  .source-panel {
    box-shadow: 0 10px 22px rgba(34, 58, 42, 0.08);
  }

  .today-card strong {
    font-size: 24px;
  }

  .quick-panel,
  .shopping-panel,
  .guide-panel,
  .pantry-panel,
  .source-panel {
    padding: 16px;
  }

  .guide-grid,
  .pantry-grid {
    grid-template-columns: 1fr;
  }

  .guide-grid article,
  .pantry-grid div {
    min-height: auto;
  }

  .search-box input {
    min-height: 56px;
    font-size: 18px;
  }

  .tab {
    min-height: 46px;
    padding: 9px 14px;
  }

  .section-heading,
  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .shopping-header {
    flex-direction: row;
    align-items: center;
  }

  .recipe-tools {
    width: 100%;
    justify-content: space-between;
  }

  .food-visual {
    min-height: 92px;
    padding: 12px;
  }

  .food-visual span {
    font-size: 14px;
    padding: 6px 9px;
  }

  .food-art {
    right: 2px;
    bottom: 4px;
    transform: scale(0.68);
  }

  .recipe-info {
    padding: 14px;
  }

  .recipe-info p {
    margin: 7px 0;
  }

  .masonry {
    columns: 1;
  }

  .card-actions {
    grid-template-columns: 1fr;
  }

  .dialog-hero h2 {
    font-size: 30px;
  }

  .recipe-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .dialog-body {
    max-height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .dialog-hero {
    min-height: 126px;
    padding: 18px 16px;
  }

  .dialog-hero .food-art {
    width: 96px;
    flex-basis: 96px;
    transform: scale(0.62);
    transform-origin: right bottom;
  }

  .dialog-content {
    padding: 18px 14px 28px;
  }

  .detail-box {
    padding: 14px;
  }

  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    box-shadow: 0 -10px 30px rgba(34, 58, 42, 0.1);
  }

  .mobile-nav button {
    min-height: 48px;
    border: 0;
    border-radius: 8px;
    background: var(--green-soft);
    color: var(--green);
    font-weight: 900;
  }

  .toast {
    bottom: calc(88px + env(safe-area-inset-bottom));
  }
}
