:root {
  --bg: #f6efe4;
  --panel: #fffaf2;
  --ink: #2b2118;
  --muted: #776b5f;
  --line: #e5d5c1;
  --accent: #256b5f;
  --accent-2: #b8673f;
  --soft: #efe0cc;
  --danger-soft: #f7e8dc;
  --shadow: 0 14px 34px rgba(55, 38, 22, 0.12);
}

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

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 0%, rgba(37, 107, 95, 0.1), transparent 30%),
    linear-gradient(180deg, #fbf5ec 0%, var(--bg) 56%, #f2e5d4 100%);
  font-family: "Songti SC", "Noto Serif SC", Georgia, serif;
}

button,
a,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
select {
  touch-action: manipulation;
}

button {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.app-shell {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

.screen-view,
.step-screen {
  display: block;
}

.hidden {
  display: none !important;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 18px;
}

.topbar > div {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-2);
  font-size: 14px;
  font-weight: 800;
}

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

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.08;
  letter-spacing: 0;
}

.flow-panel,
.day-card,
.shopping-card,
.notice,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 250, 242, 0.94);
  box-shadow: var(--shadow);
}

.flow-panel {
  margin: 0 0 14px;
  padding: 12px;
}

.meal-choice-grid,
.choice-grid,
.toolbar,
.swap-options,
.dish-list,
.plan-view {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.meal-choice-button {
  min-height: 86px;
  padding: 0 18px;
  border-color: rgba(37, 107, 95, 0.28);
  background: linear-gradient(180deg, #fffdf7, #f7ebdb);
  color: var(--accent);
  font-size: 25px;
  font-weight: 900;
  text-align: left;
}

.meal-choice-button::after {
  content: "›";
  float: right;
  color: var(--accent-2);
  font-size: 30px;
  line-height: 1;
}

.choice-field,
.toggle-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf7;
  font-size: 19px;
  font-weight: 900;
}

.choice-field select {
  min-width: 104px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid #d9c6ae;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.toggle-field {
  justify-content: flex-start;
}

.toggle-field input {
  width: 25px;
  height: 25px;
  accent-color: var(--accent);
}

.next-button,
.primary-button,
.plain-button,
.quiet-button,
.link-button {
  font-weight: 900;
}

.next-button {
  width: 100%;
  min-height: 58px;
  margin-top: 2px;
  font-size: 20px;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fffaf2;
}

.plain-button,
.quiet-button,
.link-button {
  background: var(--panel);
}

.quiet-button,
.link-button {
  min-width: 92px;
  min-height: 46px;
  padding: 0 12px;
  border-color: rgba(37, 107, 95, 0.32);
  color: var(--accent);
  font-size: 16px;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.toolbar {
  margin: 0 0 12px;
}

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

.menu-toolbar .primary-button {
  grid-column: 1 / -1;
}

.toolbar .primary-button,
.toolbar .plain-button {
  min-height: 54px;
}

.notice {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding: 13px 14px;
  color: var(--muted);
  font-size: 16px;
  box-shadow: none;
}

.notice strong {
  color: var(--ink);
}

.plan-view {
  margin-top: 0;
}

.day-card {
  overflow: hidden;
}

.day-title {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}

.day-title h2 {
  margin: 0;
  font-size: 23px;
  line-height: 1.2;
}

.meal-grid {
  display: grid;
  grid-template-columns: 1fr;
}

.meal-block {
  padding: 14px;
}

.meal-block h3 {
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 18px;
}

.dish-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  gap: 9px;
  align-items: stretch;
  min-height: 52px;
}

.dish-card-content {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #ead9c4;
  border-radius: 10px;
  background: #fffdf7;
}

.dish-name {
  min-width: 0;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.nutrition-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.nutrition-tags span {
  padding: 4px 7px;
  border-radius: 999px;
  background: #eef5ef;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
}

.swap-button {
  min-height: 52px;
  padding: 0 8px;
  border-color: rgba(184, 103, 63, 0.35);
  background: var(--danger-soft);
  color: var(--accent-2);
  font-size: 15px;
  font-weight: 900;
}

.shopping-card {
  padding: 16px;
}

.shopping-card h2 {
  margin-bottom: 14px;
  font-size: 24px;
}

.shopping-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.shopping-list li {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
  font-size: 17px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.swap-dialog {
  width: min(100% - 24px, 406px);
  max-height: calc(100dvh - 32px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  padding: 14px;
}

.swap-dialog::backdrop {
  background: rgba(43, 33, 24, 0.42);
}

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

.dialog-head h2 {
  margin: 0;
  font-size: 23px;
}

.icon-button {
  width: 46px;
  min-height: 46px;
  font-size: 28px;
  line-height: 1;
}

.option-button {
  width: 100%;
  min-height: 58px;
  padding: 11px 14px;
  text-align: left;
  font-size: 19px;
  font-weight: 900;
}

.full {
  width: 100%;
}

.empty-state {
  padding: 24px 16px;
  border-style: dashed;
  box-shadow: none;
  color: var(--muted);
  font-size: 17px;
}

@media (min-width: 431px) {
  body {
    display: grid;
    place-items: start center;
  }

  .app-shell {
    border-left: 1px solid rgba(229, 213, 193, 0.65);
    border-right: 1px solid rgba(229, 213, 193, 0.65);
  }
}

@media (max-width: 360px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  h1 {
    font-size: 30px;
  }

  .dish-row {
    grid-template-columns: minmax(0, 1fr) 70px;
  }

  .shopping-list {
    grid-template-columns: 1fr;
  }
}
