:root {
  color-scheme: light;
  --ink: #221f20;
  --muted: #67605d;
  --paper: #fbfaf7;
  --panel: #ffffff;
  --line: #ddd5cc;
  --wine: #7b1f33;
  --leaf: #245447;
  --gold: #b8873a;
  --soft: #f2ece3;
  --shadow: 0 18px 48px rgba(34, 31, 32, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
}

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

.hero-panel {
  position: relative;
  min-height: clamp(260px, 34vw, 520px);
  background: #fff;
  overflow: hidden;
}

.workspace {
  position: relative;
  z-index: 1;
}

.hero-image {
  display: block;
  width: 100%;
  height: clamp(260px, 34vw, 520px);
  object-fit: cover;
  object-position: center;
}

.eyebrow,
.panel-heading span,
.story-header span {
  margin: 0;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin: 12px 0 16px;
  max-width: 760px;
  font-size: clamp(2.1rem, 4vw, 4.2rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-copy p:last-child {
  max-width: 620px;
  margin: 0;
  color: rgba(34, 31, 32, 0.74);
  font-size: clamp(1rem, 1.15vw, 1.08rem);
  line-height: 1.6;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  width: min(1440px, calc(100% - 48px));
  margin: -22px auto 48px;
}

.control-panel,
.result-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.control-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px;
  padding: 18px;
}

.control-panel .dish-flow {
  flex: 2 1 420px;
  min-width: 320px;
}

.control-panel fieldset {
  flex: 1 1 220px;
  min-width: 220px;
}

.result-panel {
  padding: 22px;
}

.panel-heading {
  display: grid;
  gap: 4px;
}

.panel-heading strong {
  font-size: 1.2rem;
}

label,
fieldset {
  display: grid;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

fieldset {
  border: 0;
  padding: 0;
}

legend {
  padding: 0;
  margin-bottom: 8px;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

.quick-dishes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-dishes button {
  flex: 0 1 auto;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 11px;
  color: var(--leaf);
  background: #fff;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
}

.quick-dishes button:hover {
  border-color: var(--leaf);
}

.field-note {
  margin: -2px 0 0;
  color: rgba(34, 31, 32, 0.62);
  font-size: 0.88rem;
  line-height: 1.45;
}

.dish-flow,
.wine-flow {
  position: relative;
  display: grid;
  gap: 10px;
}

.recipe-menu {
  position: absolute;
  z-index: 8;
  top: 76px;
  left: 0;
  right: 0;
  max-height: 310px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(34, 31, 32, 0.16);
}

.recipe-menu[hidden] {
  display: none;
}

.recipe-option {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 54px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  text-align: left;
}

.recipe-option:hover,
.recipe-option:focus {
  background: #f4faf6;
  outline: none;
}

.recipe-option:last-child {
  border-bottom: 0;
}

.recipe-option strong {
  font-size: 0.92rem;
  line-height: 1.25;
}

.recipe-option span,
.recipe-empty {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
}

.recipe-empty {
  padding: 12px;
}

.dish-flow[hidden],
.wine-flow[hidden],
.dish-only-control[hidden] {
  display: none;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--soft);
  border-radius: 7px;
  padding: 5px;
}

.preference-switch {
  display: flex;
}

.start-switch {
  grid-template-columns: repeat(2, 1fr);
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label {
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
  padding: 0 10px;
  text-align: center;
  font-size: 0.84rem;
  line-height: 1.15;
  white-space: nowrap;
}

.segmented input:checked + label {
  color: #fff;
  background: var(--wine);
}

.slider-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--muted);
}

.story-header button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
}

.wine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.wine-card {
  display: grid;
  gap: 10px;
  min-height: 210px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
}

.wine-card h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
}

.wine-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.wine-card .price-note {
  color: rgba(34, 31, 32, 0.58);
  font-size: 0.86rem;
}

.buy-link {
  width: fit-content;
  align-self: end;
  color: var(--wine);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.buy-link:hover {
  text-decoration: underline;
}

.secondary-result-action {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--wine);
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.secondary-result-action:hover {
  border-color: var(--wine);
}

.secondary-result-action[hidden] {
  display: none;
}

.tag {
  width: fit-content;
  max-width: 100%;
  align-self: start;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--leaf);
  background: #e9f0eb;
  font-size: 0.82rem;
  font-weight: 800;
}

.story-box {
  border-left: 4px solid var(--wine);
  border-radius: 8px;
  background: var(--soft);
  padding: 18px;
}

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

.story-header button {
  min-width: 74px;
  min-height: 34px;
  color: #fff;
  background: var(--wine);
}

#storyText {
  margin: 0;
  color: #332d2b;
  font-size: 1rem;
  line-height: 1.7;
}

@media (min-width: 1180px) {
  .workspace {
    align-items: start;
    gap: 26px;
  }

  .result-panel {
    padding: 26px;
  }

  .wine-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
  }

  .wine-card {
    min-height: 230px;
  }
}

@media (min-width: 1500px) {
  .hero-panel,
  .hero-image {
    min-height: 500px;
    height: 500px;
  }

  .workspace {
    width: min(1560px, calc(100% - 72px));
  }
}

@media (max-width: 860px) {
  .workspace {
    grid-template-columns: 1fr;
    width: min(720px, calc(100% - 32px));
  }

  .control-panel {
    display: grid;
  }

  .control-panel .dish-flow,
  .control-panel fieldset {
    min-width: 0;
  }

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

@media (max-width: 560px) {
  .hero-panel {
    min-height: 260px;
  }

  .hero-image {
    height: 260px;
  }

  .workspace {
    width: calc(100% - 20px);
    margin-top: -20px;
  }

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

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

  .start-switch label {
    min-height: 38px;
    font-size: 0.86rem;
  }

  .quick-dishes button {
    min-height: 34px;
    padding: 7px 10px;
  }

  .slider-row {
    grid-template-columns: 1fr;
  }
}
