:root {
  color-scheme: light;
  --paper: #fffdf8;
  --ink: #1d1b16;
  --muted: #5e5a4f;
  --line: rgba(29, 27, 22, 0.14);
  --tomato: #c7372f;
  --leaf: #2c6e49;
  --gold: #d99a27;
  --panel: rgba(255, 253, 248, 0.93);
  --shadow: 0 24px 60px rgba(22, 18, 12, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

body.drawer-open {
  overflow: hidden;
}

button,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.hero {
  position: relative;
  min-height: 76vh;
  display: grid;
  align-items: center;
  overflow: hidden;
  background: #16120c;
}

.hero-media {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg, rgba(12, 10, 6, 0.72), rgba(12, 10, 6, 0.24)),
    url("./assets/home-dishes.png");
  background-size: cover;
  background-position: center;
}

.workspace {
  position: relative;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.2fr);
  gap: 28px;
  align-items: center;
  padding: 58px 0;
}

.intro {
  color: #fffaf0;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.26);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 0.88rem;
  font-weight: 700;
}

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

h1 {
  max-width: 9em;
  margin-bottom: 16px;
  font-size: clamp(2.2rem, 4.2vw, 4.6rem);
  line-height: 1.06;
  font-weight: 800;
}

.summary {
  max-width: 26em;
  margin-bottom: 0;
  font-size: 1.08rem;
  line-height: 1.7;
}

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

.result-panel,
.controls {
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.result-panel {
  min-height: 254px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.result-panel:hover {
  transform: translateY(-2px);
  border-color: rgba(199, 55, 47, 0.3);
}

.result-panel[aria-disabled="true"] {
  cursor: default;
}

.result-panel[aria-disabled="true"]:hover {
  transform: none;
}

.result-kicker {
  margin-bottom: 10px;
  color: var(--tomato);
  font-weight: 800;
}

.result-panel h2 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1.08;
}

.dish-meta {
  margin-bottom: 14px;
  color: var(--leaf);
  font-weight: 700;
}

.dish-description {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.detail-hint,
.card-hint {
  color: var(--tomato);
  font-size: 0.88rem;
  font-weight: 800;
}

.controls {
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 36px 0 12px;
  background: #ffffff;
  color: var(--ink);
}

select:focus,
.primary-action:focus-visible,
.result-panel:focus-visible,
.dish-card:focus-visible,
.drawer-close:focus-visible {
  outline: 3px solid rgba(44, 110, 73, 0.28);
  outline-offset: 2px;
}

.primary-action {
  min-height: 44px;
  border: 0;
  border-radius: 7px;
  padding: 0 22px;
  background: var(--tomato);
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.primary-action:hover {
  background: #a92c26;
}

.primary-action:active {
  transform: translateY(1px);
}

.primary-action.is-spinning {
  background: var(--leaf);
}

.candidates {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 52px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 2.2vw, 2.2rem);
}

.candidate-count {
  margin-bottom: 3px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.dish-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.dish-card {
  position: relative;
  min-height: 136px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.dish-card:hover {
  transform: translateY(-2px);
  border-color: rgba(199, 55, 47, 0.25);
  box-shadow: 0 16px 32px rgba(22, 18, 12, 0.1);
}

.dish-card h3 {
  margin: 0 0 8px;
  font-size: 1.12rem;
}

.dish-card p {
  margin-bottom: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.card-hint {
  display: inline-block;
  margin-top: 12px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(44, 110, 73, 0.1);
  color: var(--leaf);
  font-size: 0.78rem;
  font-weight: 700;
}

.empty-state {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 26px;
  color: var(--muted);
  background: #ffffff;
  text-align: center;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(22, 18, 12, 0.42);
  opacity: 0;
  transition: opacity 220ms ease;
}

.drawer-backdrop.is-open {
  opacity: 1;
}

.recipe-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 21;
  width: 50vw;
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--paper);
  box-shadow: -28px 0 70px rgba(22, 18, 12, 0.25);
  transform: translateX(100%);
  transition: transform 220ms ease;
}

.recipe-drawer.is-open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding: 28px 30px 18px;
  border-bottom: 1px solid var(--line);
}

.drawer-header h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.08;
}

.drawer-close {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

.drawer-close:hover {
  border-color: rgba(199, 55, 47, 0.35);
  color: var(--tomato);
}

.drawer-body {
  min-height: 0;
  overflow-y: auto;
  padding: 22px 30px 34px;
}

.drawer-description {
  margin-bottom: 22px;
  color: var(--muted);
  line-height: 1.7;
}

.recipe-section {
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.recipe-section h3 {
  margin: 0 0 14px;
  font-size: 1.14rem;
}

.ingredient-list,
.step-list {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--muted);
  line-height: 1.7;
}

.ingredient-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
}

.step-list li + li {
  margin-top: 10px;
}

.recipe-tip {
  border: 1px solid rgba(44, 110, 73, 0.18);
  border-radius: 8px;
  padding: 16px;
  background: rgba(44, 110, 73, 0.08);
}

.recipe-tip strong {
  color: var(--leaf);
}

.recipe-tip p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

@media (max-width: 880px) {
  .hero {
    min-height: auto;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding: 44px 0 30px;
  }

  h1 {
    max-width: 12em;
  }

  .controls {
    grid-template-columns: 1fr 1fr;
  }

  .primary-action {
    grid-column: 1 / -1;
  }

  .recipe-drawer {
    width: min(100%, 640px);
  }
}

@media (max-width: 560px) {
  .workspace,
  .candidates {
    width: min(100% - 24px, 1120px);
  }

  .hero-media {
    background-image:
      linear-gradient(180deg, rgba(12, 10, 6, 0.7), rgba(12, 10, 6, 0.32)),
      url("./assets/home-dishes.png");
  }

  .result-panel {
    min-height: 232px;
    padding: 22px;
  }

  .controls {
    grid-template-columns: 1fr;
  }

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

  .recipe-drawer {
    top: auto;
    bottom: 0;
    width: 100%;
    height: min(86vh, 720px);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }

  .recipe-drawer.is-open {
    transform: translateY(0);
  }

  .drawer-header {
    padding: 22px 20px 16px;
  }

  .drawer-body {
    padding: 18px 20px 28px;
  }

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