:root {
  --bg: #fbf6ee;
  --surface: #fffdf9;
  --fg: #31251d;
  --muted: #7d6d62;
  --border: #eadfd2;
  --accent: #e25b36;

  --accent-soft: color-mix(in oklch, var(--accent) 13%, var(--surface));
  --fg-soft: color-mix(in oklch, var(--fg) 7%, transparent);
  --shadow: 0 18px 50px color-mix(in oklch, var(--fg) 11%, transparent);
  --font-display: "Iowan Old Style", "Songti SC", "STSong", Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --content: 1180px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--fg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

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

img,
svg {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.14;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

:focus-visible {
  outline: 3px solid color-mix(in oklch, var(--accent) 45%, transparent);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--fg);
  color: var(--surface);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--bg) 91%, transparent);
  backdrop-filter: blur(16px);
}

.topbar-inner {
  display: flex;
  max-width: var(--content);
  height: 64px;
  margin: 0 auto;
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
}

.brand,
.topbar-action {
  display: inline-flex;
  align-items: center;
}

.brand {
  gap: 9px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.02em;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--fg);
  color: var(--surface);
  place-items: center;
}

.brand-mark svg {
  width: 20px;
}

.topbar-action {
  gap: 6px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 650;
}

.topbar-action:hover {
  border-color: var(--fg);
}

.topbar-action svg {
  width: 17px;
}

.app-layout {
  max-width: var(--content);
  margin: 0 auto;
}

#app {
  min-height: calc(100vh - 64px);
  padding-bottom: 142px;
}

.page {
  width: 100%;
  padding: 20px 16px 28px;
}

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

.page-head-copy p,
.section-note,
.muted {
  color: var(--muted);
}

.page-head h1 {
  font-size: clamp(30px, 7vw, 46px);
  letter-spacing: -.035em;
}

.page-head-copy p {
  margin-top: 5px;
  font-size: 14px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 16px;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.back-link:hover {
  color: var(--fg);
}

.back-link svg {
  width: 18px;
}

.home-hero {
  position: relative;
  overflow: hidden;
  padding: 26px 22px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.home-hero::after {
  position: absolute;
  right: -38px;
  bottom: -58px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: var(--accent-soft);
  content: "";
}

.eyebrow {
  position: relative;
  z-index: 1;
  margin-bottom: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.home-hero h1 {
  position: relative;
  z-index: 1;
  max-width: 9ch;
  font-size: clamp(38px, 11vw, 58px);
  letter-spacing: -.045em;
}

.home-hero p:not(.eyebrow) {
  position: relative;
  z-index: 1;
  max-width: 32ch;
  margin-top: 11px;
  color: var(--muted);
  font-size: 14px;
}

.search-wrap {
  position: relative;
  z-index: 2;
  margin-top: 20px;
}

.search-wrap svg {
  position: absolute;
  top: 50%;
  left: 15px;
  width: 19px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 48px;
  padding: 0 44px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--bg);
  font-size: 15px;
}

.search-input:focus {
  border-color: var(--accent);
  outline: 3px solid color-mix(in oklch, var(--accent) 18%, transparent);
}

.clear-search {
  position: absolute;
  top: 50%;
  right: 9px;
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  transform: translateY(-50%);
  place-items: center;
}

.clear-search:hover {
  background: var(--fg-soft);
}

.clear-search svg {
  position: static;
  width: 16px;
  transform: none;
}

.category-strip {
  display: flex;
  overflow-x: auto;
  margin: 16px -16px 0;
  padding: 0 16px 8px;
  gap: 8px;
  scrollbar-width: none;
}

.category-strip::-webkit-scrollbar {
  display: none;
}

.category-chip {
  flex: 0 0 auto;
  padding: 9px 15px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.category-chip[aria-pressed="true"] {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--surface);
}

.list-heading {
  display: flex;
  margin: 26px 0 14px;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.list-heading h2 {
  font-size: 25px;
  letter-spacing: -.025em;
}

.list-heading span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.recipe-list {
  display: grid;
  gap: 12px;
}

.recipe-card {
  display: grid;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 13px;
  cursor: pointer;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.recipe-card:hover {
  border-color: color-mix(in oklch, var(--fg) 28%, var(--border));
  box-shadow: 0 12px 30px color-mix(in oklch, var(--fg) 7%, transparent);
  transform: translateY(-1px);
}

.recipe-card:active {
  transform: scale(.995);
}

.recipe-card:focus-visible {
  outline: 3px solid color-mix(in oklch, var(--accent) 45%, transparent);
  outline-offset: 3px;
}

.recipe-image-link {
  display: block;
  overflow: hidden;
  min-width: 0;
  border-radius: 12px;
  background: var(--fg-soft);
  aspect-ratio: 1 / 1;
}

.recipe-image-link img,
.detail-hero img,
.menu-card img,
.form-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recipe-card-body {
  display: flex;
  min-width: 0;
  padding: 2px 1px;
  flex-direction: column;
}

.recipe-card-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.recipe-card h3 {
  overflow: hidden;
  font-size: 19px;
  letter-spacing: -.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.heart-button,
.icon-button {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  place-items: center;
}

.heart-button:hover,
.heart-button.is-active,
.icon-button:hover {
  border-color: var(--fg);
  color: var(--fg);
}

.heart-button.is-active svg {
  fill: currentColor;
}

.heart-button svg,
.icon-button svg {
  width: 17px;
}

.recipe-description {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.recipe-meta,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.recipe-meta {
  margin-top: 7px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.recipe-meta span + span::before {
  margin-right: 7px;
  color: var(--border);
  content: "·";
}

.recipe-card-actions {
  display: flex;
  margin-top: auto;
  padding-top: 7px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-menu-stepper {
  display: inline-grid;
  overflow: hidden;
  min-height: 34px;
  border: 1px solid var(--fg);
  border-radius: 999px;
  background: var(--fg);
  color: var(--surface);
  align-items: center;
  grid-template-columns: 30px auto 30px;
}

.card-menu-stepper button {
  display: grid;
  width: 30px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  place-items: center;
}

.card-menu-stepper button:hover {
  background: color-mix(in oklch, var(--surface) 14%, transparent);
}

.card-menu-stepper svg {
  width: 13px;
}

.card-menu-stepper span {
  padding: 0 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: nowrap;
}

.mini-tag,
.tag {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
}

.mini-tag {
  padding: 3px 7px;
  font-size: 10px;
}

.tag {
  padding: 6px 10px;
  font-size: 12px;
}

.add-button,
.primary-button,
.secondary-button,
.danger-button,
.text-button {
  display: inline-flex;
  min-height: 42px;
  border-radius: 12px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 700;
}

.add-button {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  background: var(--fg);
  color: var(--surface);
  font-size: 12px;
}

.add-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.add-button:active,
.primary-button:active {
  transform: translateY(1px);
}

.add-button svg,
.primary-button svg,
.secondary-button svg,
.danger-button svg {
  width: 17px;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 48px;
  padding: 0 18px;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--surface);
}

.secondary-button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
}

.secondary-button:hover {
  border-color: var(--fg);
}

.danger-button {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
}

.danger-button:hover {
  border-color: var(--fg);
  background: var(--fg-soft);
}

.text-button {
  min-height: 36px;
  padding: 0 5px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.text-button:hover {
  color: var(--fg);
}

.empty-state {
  display: grid;
  min-height: 300px;
  padding: 42px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  background: color-mix(in oklch, var(--surface) 66%, transparent);
  text-align: center;
  place-items: center;
}

.empty-state-inner {
  max-width: 330px;
}

.empty-icon {
  display: grid;
  width: 62px;
  height: 62px;
  margin: 0 auto 18px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  place-items: center;
}

.empty-icon svg {
  width: 28px;
}

.empty-state h2 {
  font-size: 26px;
}

.empty-state p {
  margin: 8px auto 20px;
  color: var(--muted);
  font-size: 14px;
}

.detail-page {
  max-width: 820px;
  margin: 0 auto;
}

.detail-hero {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  aspect-ratio: 3 / 2;
}

.detail-title-row {
  display: flex;
  margin-top: 20px;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.detail-title-row h1 {
  font-size: clamp(34px, 9vw, 56px);
  letter-spacing: -.04em;
}

.detail-description {
  max-width: 55ch;
  margin-top: 9px;
  color: var(--muted);
}

.detail-meta {
  display: grid;
  margin: 20px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  grid-template-columns: repeat(4, 1fr);
}

.detail-meta-item {
  padding: 14px 8px;
  text-align: center;
}

.detail-meta-item + .detail-meta-item {
  border-left: 1px solid var(--border);
}

.detail-meta-item strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 15px;
}

.detail-meta-item span {
  color: var(--muted);
  font-size: 11px;
}

.detail-section {
  padding: 24px 0;
  border-top: 1px solid var(--border);
}

.detail-section:first-of-type {
  border-top: 0;
}

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

.detail-section h2 {
  font-size: 25px;
  letter-spacing: -.025em;
}

.serving-stepper,
.quantity-stepper {
  display: inline-grid;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  align-items: center;
  grid-template-columns: 38px minmax(44px, auto) 38px;
}

.serving-stepper button,
.quantity-stepper button {
  display: grid;
  width: 38px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  place-items: center;
}

.serving-stepper button:hover,
.quantity-stepper button:hover {
  background: var(--fg-soft);
}

.serving-stepper span,
.quantity-stepper span {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
}

.ingredient-groups {
  display: grid;
  gap: 18px;
}

.ingredient-group-title {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.ingredient-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ingredient-list li {
  display: flex;
  min-height: 44px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ingredient-list li:last-child {
  border-bottom: 0;
}

.ingredient-amount {
  flex: 0 0 auto;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: right;
}

.step-list {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 17px;
  list-style: none;
}

.step-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
}

.step-number {
  display: grid;
  width: 34px;
  height: 34px;
  border: 1px solid var(--fg);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 12px;
  place-items: center;
}

.step-item p {
  padding-top: 5px;
}

.tips-box {
  padding: 18px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
}

.detail-actions {
  display: grid;
  margin-top: 10px;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sticky-detail-action {
  position: sticky;
  z-index: 15;
  bottom: 76px;
  display: grid;
  margin: 12px -4px -8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: color-mix(in oklch, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  grid-template-columns: auto 1fr;
  gap: 10px;
}

.menu-layout {
  display: grid;
  gap: 26px;
}

.menu-advice {
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid color-mix(in oklch, var(--accent) 30%, var(--border));
  border-radius: var(--radius);
  background: var(--accent-soft);
}

.menu-advice strong {
  font-size: 13px;
}

.menu-advice ul {
  margin: 5px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
}

.menu-advice li + li {
  margin-top: 3px;
}

.menu-cards {
  display: grid;
  gap: 10px;
}

.menu-card {
  display: grid;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 12px;
}

.menu-card img {
  border-radius: 11px;
  aspect-ratio: 1 / 1;
}

.menu-card-main {
  min-width: 0;
}

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

.menu-card h3 {
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-card-bottom {
  display: flex;
  margin-top: 10px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.menu-total {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--fg);
  color: var(--surface);
}

.menu-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.menu-total h2 {
  font-size: 24px;
}

.menu-total p {
  margin-top: 4px;
  color: color-mix(in oklch, var(--surface) 72%, transparent);
  font-size: 13px;
}

.menu-total .primary-button {
  flex: 0 0 auto;
}

.shopping-list {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.shopping-list h2 {
  margin-bottom: 4px;
  font-size: 24px;
}

.shopping-list-note {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px;
}

.shopping-item {
  display: grid;
  min-height: 46px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 9px;
  cursor: pointer;
}

.shopping-item:last-child {
  border-bottom: 0;
}

.shopping-item input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--fg);
}

.shopping-item.is-checked {
  color: var(--muted);
  text-decoration: line-through;
}

.shopping-item .ingredient-amount {
  text-decoration: none;
}

.floating-menu {
  position: fixed;
  z-index: 25;
  right: 14px;
  bottom: 82px;
  left: 14px;
  max-width: 520px;
  margin: 0 auto;
}

.floating-menu a {
  display: flex;
  min-height: 54px;
  padding: 8px 9px 8px 16px;
  border-radius: 17px;
  background: var(--fg);
  color: var(--surface);
  box-shadow: var(--shadow);
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.floating-menu-copy {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.floating-menu-copy strong {
  font-family: var(--font-display);
  font-size: 18px;
}

.floating-menu-copy span {
  color: color-mix(in oklch, var(--surface) 66%, transparent);
  font-size: 12px;
}

.floating-menu-cta {
  display: inline-flex;
  min-height: 38px;
  padding: 0 13px;
  border-radius: 11px;
  background: var(--accent);
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 750;
}

.bottom-nav {
  position: fixed;
  z-index: 24;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  min-height: 70px;
  padding: 7px 8px max(7px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: color-mix(in oklch, var(--surface) 94%, transparent);
  backdrop-filter: blur(18px);
  grid-template-columns: repeat(4, 1fr);
}

.bottom-nav a {
  display: flex;
  min-width: 0;
  color: var(--muted);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  font-size: 10px;
  font-weight: 650;
}

.bottom-nav a.is-active {
  color: var(--fg);
}

.bottom-nav svg {
  width: 22px;
  height: 22px;
}

.nav-icon-wrap {
  position: relative;
}

.nav-count {
  position: absolute;
  top: -7px;
  right: -10px;
  display: grid;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--fg);
  color: var(--surface);
  font-family: var(--font-mono);
  font-size: 9px;
  place-items: center;
}

.desktop-basket {
  display: none;
}

.data-safety {
  display: grid;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid color-mix(in oklch, var(--accent) 30%, var(--border));
  border-radius: var(--radius);
  background: var(--accent-soft);
  gap: 14px;
}

.data-safety strong {
  font-size: 14px;
}

.data-safety p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

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

.data-actions .secondary-button {
  min-height: 42px;
  padding: 0 12px;
  font-size: 12px;
}

.import-button {
  position: relative;
  cursor: pointer;
}

.import-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.form-page {
  max-width: 820px;
  margin: 0 auto;
}

.recipe-form {
  display: grid;
  gap: 18px;
}

.form-section {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.form-section h2 {
  margin-bottom: 15px;
  font-size: 23px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid.two {
  grid-template-columns: 1fr 1fr;
}

.field {
  display: grid;
  gap: 6px;
}

.field label,
.field-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.input,
.textarea,
.select {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg);
  font-size: 14px;
}

.textarea {
  min-height: 100px;
  resize: vertical;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--accent);
  outline: 3px solid color-mix(in oklch, var(--accent) 17%, transparent);
}

.field-help {
  color: var(--muted);
  font-size: 11px;
}

.form-image-preview {
  overflow: hidden;
  width: 100%;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  aspect-ratio: 3 / 2;
}

.form-image-preview.is-empty {
  display: grid;
  color: var(--muted);
  place-items: center;
}

.form-image-preview.is-empty svg {
  width: 34px;
  margin: 0 auto 8px;
}

.upload-button {
  display: inline-flex;
  width: fit-content;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.upload-button:hover {
  border-color: var(--fg);
}

.upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.dynamic-list {
  display: grid;
  gap: 10px;
}

.ingredient-row {
  display: grid;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  grid-template-columns: minmax(0, 1fr) 70px 70px 34px;
  gap: 8px;
}

.ingredient-row .ingredient-note,
.ingredient-row .ingredient-group-select {
  grid-column: span 2;
}

.step-row {
  display: grid;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 8px;
}

.step-row .textarea {
  min-height: 80px;
}

.remove-row {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  place-items: center;
}

.remove-row:hover {
  border-color: var(--fg);
  color: var(--fg);
}

.remove-row svg {
  width: 15px;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.cook-page {
  min-height: calc(100vh - 64px);
  background: var(--fg);
  color: var(--surface);
}

.cook-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.cook-page .back-link,
.cook-page .muted {
  color: color-mix(in oklch, var(--surface) 66%, transparent);
}

.cook-dish-tabs {
  display: flex;
  overflow-x: auto;
  margin: 0 -16px 20px;
  padding: 0 16px 8px;
  gap: 8px;
  scrollbar-width: none;
}

.cook-dish-tabs button {
  flex: 0 0 auto;
  padding: 9px 13px;
  border: 1px solid color-mix(in oklch, var(--surface) 24%, transparent);
  border-radius: 999px;
  background: transparent;
  color: color-mix(in oklch, var(--surface) 68%, transparent);
  font-size: 12px;
}

.cook-dish-tabs button.is-active {
  border-color: var(--surface);
  background: var(--surface);
  color: var(--fg);
}

.cook-progress {
  overflow: hidden;
  height: 4px;
  margin: 14px 0 26px;
  border-radius: 999px;
  background: color-mix(in oklch, var(--surface) 18%, transparent);
}

.cook-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width .2s ease;
}

.cook-step-card {
  display: grid;
  min-height: 360px;
  padding: 28px 22px;
  border: 1px solid color-mix(in oklch, var(--surface) 18%, transparent);
  border-radius: var(--radius-lg);
  background: color-mix(in oklch, var(--surface) 5%, var(--fg));
  align-content: center;
}

.cook-kicker {
  color: color-mix(in oklch, var(--surface) 62%, transparent);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .08em;
}

.cook-step-card h1 {
  margin: 16px 0;
  font-size: clamp(35px, 9vw, 58px);
  letter-spacing: -.035em;
}

.cook-step-text {
  font-family: var(--font-display);
  font-size: clamp(23px, 6vw, 34px);
  line-height: 1.5;
}

.cook-controls {
  display: grid;
  margin-top: 18px;
  grid-template-columns: 1fr 1.35fr;
  gap: 10px;
}

.cook-controls button {
  min-height: 52px;
  border-radius: 13px;
  font-weight: 750;
}

.cook-prev {
  border: 1px solid color-mix(in oklch, var(--surface) 24%, transparent);
  background: transparent;
  color: var(--surface);
}

.cook-next {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--surface);
}

.cook-finish {
  width: 100%;
  min-height: 44px;
  margin-top: 12px;
  border: 0;
  background: transparent;
  color: color-mix(in oklch, var(--surface) 64%, transparent);
}

.toast {
  position: fixed;
  z-index: 80;
  top: 76px;
  left: 50%;
  max-width: calc(100vw - 32px);
  padding: 10px 15px;
  border-radius: 999px;
  background: var(--fg);
  color: var(--surface);
  box-shadow: var(--shadow);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -12px);
  transition: opacity .2s ease, transform .2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 440px) {
  .topbar-action span {
    display: none;
  }

  .topbar-action {
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
  }

  .form-grid.two {
    grid-template-columns: 1fr;
  }

  .ingredient-row {
    grid-template-columns: minmax(0, 1fr) 64px 60px 34px;
  }
}

@media (min-width: 760px) {
  .page {
    padding: 28px 24px 40px;
  }

  .home-hero {
    padding: 38px 36px 34px;
  }

  .home-hero h1 {
    max-width: none;
  }

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

  .menu-layout {
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
    align-items: start;
  }

  .shopping-list {
    position: sticky;
    top: 88px;
  }

  .form-section {
    padding: 24px;
  }
}

@media (min-width: 980px) {
  .topbar-inner {
    padding: 0 24px;
  }

  .app-layout {
    display: grid;
    padding: 0 24px;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px;
  }

  #app {
    min-width: 0;
    padding-bottom: 40px;
  }

  .page {
    padding-right: 0;
    padding-left: 0;
  }

  .bottom-nav,
  .floating-menu {
    display: none;
  }

  .desktop-basket {
    display: block;
    min-width: 0;
  }

  .desktop-basket-inner {
    position: sticky;
    top: 88px;
    margin-top: 28px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
  }

  .desktop-basket-inner h2 {
    font-size: 23px;
  }

  .desktop-basket-list {
    display: grid;
    max-height: 48vh;
    overflow: auto;
    margin: 14px 0;
    padding: 0;
    list-style: none;
    gap: 10px;
  }

  .desktop-basket-list li {
    display: flex;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
  }

  .desktop-basket-list li:last-child {
    border-bottom: 0;
  }

  .desktop-basket-empty {
    margin: 18px 0;
    color: var(--muted);
    font-size: 13px;
  }

  .desktop-basket-inner .primary-button {
    width: 100%;
  }

  .detail-page,
  .form-page,
  .menu-page,
  .cook-page {
    grid-column: 1 / -1;
  }

  body:has(.detail-page) .desktop-basket,
  body:has(.form-page) .desktop-basket,
  body:has(.menu-page) .desktop-basket,
  body:has(.cook-page) .desktop-basket {
    display: none;
  }

  body:has(.detail-page) .app-layout,
  body:has(.form-page) .app-layout,
  body:has(.menu-page) .app-layout,
  body:has(.cook-page) .app-layout {
    display: block;
  }

  .sticky-detail-action {
    bottom: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}
