:root {
  color-scheme: light;
  --bg: #f6f2ea;
  --surface: #fffaf3;
  --surface-strong: #ffffff;
  --text: #27231f;
  --muted: #746b61;
  --line: #e8ddcf;
  --accent: #2c7a62;
  --accent-dark: #1f5d49;
  --accent-soft: #eaf5ef;
  --warm: #b86138;
  --warm-soft: #f8eadf;
  --gold-soft: #fff4cf;
  --danger: #a23b2a;
  --shadow: 0 18px 38px rgba(69, 51, 33, 0.09);
  --shadow-soft: 0 8px 20px rgba(69, 51, 33, 0.06);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 8%, rgba(44, 122, 98, 0.14), transparent 28%),
    radial-gradient(circle at 92% 2%, rgba(184, 97, 56, 0.12), transparent 24%),
    var(--bg);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 34px;
}

.topbar {
  display: grid;
  grid-template-areas:
    "intro account"
    "summary account";
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px 20px;
  align-items: stretch;
  border: 1px solid rgba(232, 221, 207, 0.8);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 250, 243, 0.96), rgba(255, 255, 255, 0.86)),
    var(--surface);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 22px;
}

.topbar > div:first-child {
  grid-area: intro;
}

.eyebrow,
.section-kicker,
.dish-category {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.04;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 520px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

h2 {
  margin-bottom: 0;
  font-size: 21px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 0;
  font-size: 19px;
}

.summary-grid {
  grid-area: summary;
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  gap: 10px;
}

.summary-grid div {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.74);
  padding: 14px 16px;
  box-shadow: var(--shadow-soft);
}

.summary-grid span {
  display: block;
  font-size: 28px;
  font-weight: 800;
}

.summary-grid small {
  color: var(--muted);
}

.account-panel {
  grid-area: account;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-soft);
  padding: 16px;
}

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

.account-head strong {
  display: block;
  font-size: 18px;
}

.login-form {
  display: grid;
  gap: 8px;
}

.login-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.auth-message.error {
  color: var(--danger);
}

.auth-message.success {
  color: var(--accent-dark);
}

body.is-guest .layout {
  opacity: 0.72;
}

body.is-guest .layout button,
body.is-guest .layout input,
body.is-guest .layout select,
body.is-guest .layout textarea {
  pointer-events: none;
}

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

.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 250, 243, 0.94);
  box-shadow: var(--shadow);
}

.today-panel {
  position: sticky;
  top: 18px;
  overflow: hidden;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(234, 245, 239, 0.96), rgba(255, 250, 243, 0.96)),
    var(--surface);
}

.main-panel {
  display: grid;
  gap: 18px;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.compact {
  margin-bottom: 14px;
}

.toolbar {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 250, 243, 0.94);
  box-shadow: var(--shadow-soft);
  padding: 16px;
}

.search-box {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.search-box span,
.dish-form label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-strong);
  color: var(--text);
  padding: 12px 13px;
  outline: none;
}

input[type="file"] {
  cursor: pointer;
  padding: 10px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 125, 99, 0.14);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip,
.ghost-button,
.icon-button,
.secondary-button,
.primary-button {
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 9px 13px;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.filter-chip {
  background: var(--surface-strong);
  border-color: var(--line);
  color: var(--muted);
}

.filter-chip.active {
  background: var(--accent-soft);
  border-color: rgba(47, 125, 99, 0.35);
  color: var(--accent-dark);
  font-weight: 800;
}

.primary-button {
  background: linear-gradient(180deg, #32876c, var(--accent));
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 16px rgba(44, 122, 98, 0.18);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover,
.filter-chip:hover {
  transform: translateY(-1px);
}

.secondary-button {
  background: var(--warm-soft);
  border-color: rgba(185, 95, 53, 0.25);
  color: #7b3c20;
  font-weight: 800;
}

.ghost-button,
.icon-button {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

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

.dish-panel,
.form-panel {
  padding: 20px;
}

.dish-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

.dish-card {
  display: grid;
  gap: 10px;
  min-height: 374px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(180deg, #ffffff, #fffdf9);
  box-shadow: var(--shadow-soft);
  padding: 16px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.dish-card:hover {
  border-color: rgba(44, 122, 98, 0.22);
  box-shadow: 0 16px 28px rgba(69, 51, 33, 0.1);
  transform: translateY(-2px);
}

.dish-cover {
  display: grid;
  min-height: 150px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(44, 122, 98, 0.16), rgba(184, 97, 56, 0.12)),
    var(--accent-soft);
  background-position: center;
  background-size: cover;
  color: var(--accent-dark);
  font-weight: 800;
}

.empty-cover {
  font-size: 15px;
}

.dish-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.favorite-button {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--gold-soft);
  color: var(--warm);
  font-size: 18px;
}

.ingredients,
.seasonings,
.method,
.dish-note {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.ingredients {
  min-height: 28px;
}

.seasonings {
  min-height: 24px;
}

.method {
  min-height: 44px;
}

.dish-note {
  min-height: 32px;
}

.dish-meta,
.dish-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.dish-meta span {
  border-radius: 999px;
  background: #f4efe7;
  color: var(--muted);
  padding: 5px 9px;
  font-size: 12px;
}

.dish-actions {
  margin-top: auto;
}

.today-list {
  display: grid;
  gap: 10px;
  min-height: 150px;
}

.today-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-strong);
  padding: 13px;
  box-shadow: var(--shadow-soft);
}

.today-item strong {
  display: block;
}

.today-item span {
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  color: var(--muted);
  line-height: 1.55;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.shopping-list {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.shopping-list ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.shopping-list li {
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 6px 10px;
  font-weight: 700;
}

.dish-form {
  display: grid;
  gap: 13px;
}

.dish-form label {
  display: grid;
  gap: 7px;
}

.checkbox-line {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-line input {
  width: 18px;
  height: 18px;
}

@media (max-width: 1100px) {
  .topbar {
    grid-template-areas:
      "intro"
      "summary"
      "account";
    grid-template-columns: 1fr;
  }

  .layout,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .today-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1440px);
    padding: 16px 0;
  }

  .topbar,
  .summary-grid,
  .action-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 16px;
    border-radius: 14px;
  }

  .summary-grid {
    gap: 8px;
  }

  .summary-grid div {
    min-height: 68px;
  }

  .search-box {
    grid-template-columns: 1fr;
  }

  .dish-actions button {
    flex: 1 1 120px;
  }
}
