@font-face {
  font-family: "Pretendard";
  src: url("./assets/PretendardVariable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f7f5ef;
  --bg-deep: #f0ede5;
  --surface: #fdfcf8;
  --surface-raised: #fffefa;
  --ink: #20221f;
  --muted: #77786f;
  --muted-2: #a3a399;
  --line: rgba(41, 44, 39, 0.11);
  --line-strong: rgba(41, 44, 39, 0.18);
  --accent: #2f5042;
  --accent-ink: #f4f4eb;
  --accent-soft: #e7ece7;
  --warm: #a45d3f;
  --danger: #a8463d;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 26px;
  --shadow-soft: 0 20px 50px rgba(32, 34, 31, 0.08);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

html[data-theme="dark"] {
  --bg: #151714;
  --bg-deep: #1b1e1a;
  --surface: #1d201c;
  --surface-raised: #242721;
  --ink: #eeeee6;
  --muted: #a4a59b;
  --muted-2: #74776e;
  --line: rgba(239, 240, 231, 0.11);
  --line-strong: rgba(239, 240, 231, 0.19);
  --accent: #9cb7a7;
  --accent-ink: #152019;
  --accent-soft: #29342e;
  --warm: #d08a68;
  --shadow-soft: 0 20px 55px rgba(0, 0, 0, 0.24);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 72% -10%, rgba(47, 80, 66, 0.055), transparent 30rem),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: -0.015em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input { font: inherit; }

button { color: inherit; }

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

button { cursor: pointer; }

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 9px;
  background: var(--ink);
  color: var(--bg);
  transform: translateY(-150%);
  transition: transform 180ms ease;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.app-shell {
  min-height: 100dvh;
  padding-bottom: calc(112px + var(--safe-bottom));
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 1180px);
  height: 74px;
  margin: 0 auto;
  padding: 0 clamp(22px, 4vw, 46px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(20px) saturate(120%);
  transition: border-color 220ms ease, height 220ms ease;
}

.topbar.is-scrolled { border-bottom-color: var(--line); }

.brand,
.avatar-button,
.icon-button {
  border: 0;
  background: transparent;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 18px;
  font-weight: 730;
  letter-spacing: -0.045em;
}

.brand-mark {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  width: 25px;
  height: 25px;
  padding: 5px;
  border-radius: 8px;
  background: var(--accent);
}

.brand-mark i {
  display: block;
  height: 1.5px;
  border-radius: 99px;
  background: var(--accent-ink);
}

.brand-mark i:nth-child(2) { width: 75%; }
.brand-mark i:nth-child(3) { width: 52%; }

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button,
.avatar-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.icon-button { color: var(--muted); }
.icon-button svg { width: 19px; }

.avatar-button {
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

main {
  width: min(100%, 1180px);
  margin: 0 auto;
}

.view { display: none; }

.view.is-active {
  display: block;
  animation: view-in 360ms cubic-bezier(.2, .75, .25, 1) both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.reveal {
  animation: reveal-up 700ms cubic-bezier(.16, 1, .3, 1) both;
}

.delay-1 { animation-delay: 80ms; }
.delay-2 { animation-delay: 160ms; }
.delay-3 { animation-delay: 240ms; }

@keyframes reveal-up {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow,
.section-kicker,
.detail-section-heading p,
.detail-title-wrap p {
  margin: 0 0 9px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 730;
  letter-spacing: 0.15em;
  line-height: 1.2;
}

.home-hero {
  padding: clamp(55px, 8vw, 98px) clamp(22px, 7vw, 88px) clamp(62px, 8vw, 96px);
}

.home-hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(37px, 6vw, 65px);
  font-weight: 720;
  letter-spacing: -0.058em;
  line-height: 1.12;
}

.hero-copy {
  margin: 20px 0 36px;
  color: var(--muted);
  font-size: clamp(15px, 2vw, 18px);
  letter-spacing: -0.025em;
}

.import-box {
  max-width: 680px;
  padding: 9px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--surface-raised);
  box-shadow: 0 16px 45px rgba(41, 45, 39, 0.06);
}

.import-field {
  display: flex;
  align-items: center;
  height: 55px;
  padding: 0 10px 0 14px;
}

.import-field > svg {
  flex: 0 0 auto;
  width: 20px;
  color: var(--muted-2);
}

.import-field input {
  min-width: 0;
  flex: 1;
  height: 100%;
  padding: 0 13px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
}

.import-field input::placeholder { color: var(--muted-2); }

.paste-button {
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 0;
  border-radius: 8px;
  background: var(--bg-deep);
  color: var(--muted);
  font-size: 12px;
  font-weight: 620;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  border: 0;
  border-radius: 13px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.02em;
  box-shadow: 0 8px 22px rgba(47, 80, 66, 0.16);
  transition: transform 130ms ease, opacity 130ms ease;
}

.primary-button:active { transform: scale(.985); }
.primary-button svg { width: 18px; }

.import-button { width: 100%; }

.import-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 12px 0 4px;
  color: var(--muted-2);
  font-size: 11px;
}

.import-note svg { width: 12px; }

.content-section {
  padding: 0 clamp(22px, 4vw, 46px);
  margin-bottom: clamp(72px, 10vw, 118px);
}

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

.section-heading h2,
.detail-section-heading h2 {
  margin: 0;
  font-size: clamp(21px, 3vw, 26px);
  font-weight: 690;
  letter-spacing: -0.045em;
  line-height: 1.25;
}

.text-button,
.quiet-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 570;
  white-space: nowrap;
}

.text-button svg,
.quiet-button svg { width: 15px; }

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(16px, 2.3vw, 26px);
}

.recipe-card {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.recipe-image-wrap {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 1 / 1.13;
  border-radius: var(--radius);
  background: var(--bg-deep);
}

.recipe-image-wrap::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(19, 20, 18, .13));
  content: "";
}

.recipe-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 650ms cubic-bezier(.2, .75, .25, 1);
}

.recipe-card:hover img { transform: scale(1.025); }
.recipe-card:nth-child(1) img { object-position: 61% center; }
.recipe-card:nth-child(2) img { object-position: 51% 55%; }

.save-badge {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  background: rgba(29, 31, 28, .32);
  color: #fff;
  backdrop-filter: blur(12px);
}

.save-badge svg { width: 15px; fill: rgba(255,255,255,.9); }

.recipe-meta {
  display: block;
  padding-top: 15px;
}

.recipe-meta strong {
  display: block;
  overflow: hidden;
  margin-bottom: 5px;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipe-meta > span {
  color: var(--muted);
  font-size: 13px;
}

.recipe-meta b {
  padding: 0 3px;
  color: var(--muted-2);
  font-weight: 400;
}

.editorial-row { max-width: 820px; }

.section-heading.compact { align-items: center; }

.week-count {
  padding: 6px 10px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
}

.week-panel {
  padding: clamp(24px, 4vw, 34px) 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.week-progress {
  overflow: hidden;
  height: 3px;
  margin-bottom: 14px;
  border-radius: 99px;
  background: var(--bg-deep);
}

.week-progress span {
  display: block;
  width: var(--progress);
  height: 100%;
  background: var(--accent);
}

.week-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  color: var(--muted-2);
  font-size: 11px;
  text-align: center;
}

.week-days .done { color: var(--accent); font-weight: 680; }

.week-panel > p {
  margin: 30px 0 0;
  font-size: clamp(18px, 2.8vw, 23px);
  font-weight: 570;
  letter-spacing: -0.04em;
  line-height: 1.55;
}

.collection-section { margin-bottom: 35px; }

.collection-feature {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  overflow: hidden;
  width: 100%;
  min-height: 310px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: #283a32;
  color: #f2f0e8;
  text-align: left;
}

.collection-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(30px, 6vw, 64px);
}

.collection-copy em {
  margin-bottom: 22px;
  color: #a6b8aa;
  font-size: 10px;
  font-style: normal;
  font-weight: 720;
  letter-spacing: .16em;
}

.collection-copy strong {
  font-size: clamp(25px, 4vw, 40px);
  font-weight: 650;
  letter-spacing: -.055em;
  line-height: 1.22;
}

.collection-copy small {
  margin-top: 15px;
  color: rgba(242, 240, 232, .64);
  font-size: 13px;
}

.collection-copy > svg { width: 21px; margin-top: 32px; }

.collection-still { min-height: 100%; }
.collection-still img { width: 100%; height: 100%; object-fit: cover; }

.page-intro {
  padding: clamp(54px, 8vw, 90px) clamp(22px, 4vw, 46px) 36px;
}

.page-intro h1 {
  margin: 0;
  font-size: clamp(39px, 6vw, 57px);
  font-weight: 720;
  letter-spacing: -.06em;
  line-height: 1.15;
}

.page-intro > p:last-child,
.profile-intro > div > p:last-child {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.library-tools {
  padding: 0 clamp(22px, 4vw, 46px) 31px;
}

.search-box {
  display: flex;
  align-items: center;
  max-width: 560px;
  height: 53px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line-strong);
}

.search-box svg { width: 19px; color: var(--muted-2); }

.search-box input {
  width: 100%;
  height: 100%;
  padding: 0 12px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.search-box input::placeholder { color: var(--muted-2); }

.filter-row {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding: 25px 1px 2px;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar { display: none; }

.filter-pill {
  flex: 0 0 auto;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.filter-pill span { margin-left: 3px; color: var(--muted-2); }

.filter-pill.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

.filter-pill.is-active span { color: color-mix(in srgb, var(--bg) 65%, transparent); }

.library-list { padding: 0 clamp(22px, 4vw, 46px); }

.library-item {
  display: grid;
  grid-template-columns: 94px 1fr 22px;
  align-items: center;
  gap: 19px;
  width: 100%;
  padding: 20px 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.library-item:last-child { border-bottom: 1px solid var(--line); }

.library-item img {
  width: 94px;
  height: 94px;
  border-radius: 13px;
  object-fit: cover;
}

.library-item:nth-child(2) img { object-position: center 55%; }

.library-item > span { min-width: 0; }

.library-item strong {
  display: block;
  margin-bottom: 4px;
  overflow: hidden;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -.035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-item small { display: block; color: var(--muted); font-size: 13px; }

.library-item em {
  display: inline-block;
  margin-top: 9px;
  color: var(--accent);
  font-size: 11px;
  font-style: normal;
  font-weight: 650;
}

.library-item > svg { width: 18px; color: var(--muted-2); }

.empty-state {
  padding: 72px 24px;
  text-align: center;
}

.empty-graphic {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  gap: 7px;
  width: 86px;
  height: 86px;
  padding: 27px 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
}

.empty-graphic::before {
  position: absolute;
  right: 17px;
  bottom: 16px;
  width: 17px;
  height: 17px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: var(--bg);
  content: "";
}

.empty-graphic::after {
  position: absolute;
  right: 10px;
  bottom: 9px;
  width: 10px;
  height: 1px;
  background: var(--accent);
  rotate: 45deg;
  content: "";
}

.empty-graphic i { height: 2px; border-radius: 2px; background: var(--muted-2); }
.empty-graphic i:nth-child(2) { width: 70%; }
.empty-graphic i:nth-child(3) { width: 48%; }

.empty-state h2 { margin: 22px 0 7px; font-size: 20px; }
.empty-state p { margin: 0 0 23px; color: var(--muted); font-size: 14px; }

.secondary-button {
  min-height: 46px;
  padding: 0 19px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 620;
}

.shopping-intro { padding-bottom: 24px; }

.shopping-progress {
  overflow: hidden;
  height: 3px;
  margin: 0 clamp(22px, 4vw, 46px) 44px;
  background: var(--bg-deep);
}

.shopping-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 400ms cubic-bezier(.2,.8,.2,1);
}

.shopping-groups { padding: 0 clamp(22px, 4vw, 46px); }

.shopping-group { margin-bottom: 44px; }

.shopping-group header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-strong);
}

.shopping-group h2 { margin: 0; font-size: 20px; letter-spacing: -.04em; }
.shopping-group header span { color: var(--muted-2); font-size: 12px; }

.check-row {
  display: grid;
  grid-template-columns: 25px 1fr auto;
  align-items: center;
  gap: 13px;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

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

.checkmark {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  color: transparent;
  transition: background 180ms ease, border-color 180ms ease, transform 130ms ease;
}

.checkmark svg { width: 13px; }

.check-row input:checked + .checkmark {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  transform: scale(.95);
}

.check-row input:checked ~ span:not(.checkmark) { color: var(--muted-2); text-decoration: line-through; }
.check-row > small { color: var(--muted); font-size: 13px; }

.add-item-button {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 4px clamp(22px, 4vw, 46px) 20px;
  padding: 10px 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  font-weight: 650;
}

.add-item-button svg { width: 17px; }

.profile-intro {
  display: flex;
  align-items: center;
  gap: 21px;
}

.large-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 22px;
  font-weight: 700;
}

.profile-intro h1 { font-size: clamp(32px, 5vw, 48px); }

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 7px clamp(22px, 4vw, 46px) 58px;
  padding: 25px 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.profile-stats > span { padding-left: clamp(6px, 2.5vw, 28px); border-left: 1px solid var(--line); }
.profile-stats > span:first-child { padding-left: 0; border-left: 0; }
.profile-stats strong { display: block; font-size: clamp(21px, 4vw, 28px); letter-spacing: -.04em; }
.profile-stats small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }

.settings-list { padding: 0 clamp(22px, 4vw, 46px); }

.settings-section-label {
  margin-bottom: 9px;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .1em;
}

.settings-section-label.second { margin-top: 40px; }

.settings-list > button {
  display: grid;
  grid-template-columns: 42px 1fr 20px;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 72px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.settings-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
}

.settings-icon svg { width: 18px; }
.settings-list button > span:nth-child(2) { min-width: 0; }
.settings-list strong { display: block; font-size: 15px; font-weight: 620; }
.settings-list small { display: block; overflow: hidden; margin-top: 2px; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.settings-list button > svg { width: 17px; color: var(--muted-2); }
.version { margin: 54px 0 10px; color: var(--muted-2); font-size: 11px; text-align: center; }

.bottom-nav {
  position: fixed;
  z-index: 40;
  right: 50%;
  bottom: calc(12px + var(--safe-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(calc(100% - 24px), 480px);
  min-height: 68px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: color-mix(in srgb, var(--surface-raised) 90%, transparent);
  box-shadow: 0 15px 45px rgba(28, 31, 27, .13);
  backdrop-filter: blur(24px) saturate(125%);
  transform: translateX(50%);
}

.bottom-nav.is-hidden { display: none; }

.bottom-nav button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--muted-2);
}

.bottom-nav button svg { width: 20px; stroke-width: 1.7; }
.bottom-nav button span { font-size: 10px; font-weight: 590; }
.bottom-nav button.is-active { background: var(--accent-soft); color: var(--accent); }

.bottom-nav em {
  position: absolute;
  top: 6px;
  left: calc(50% + 7px);
  display: grid;
  place-items: center;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border: 1.5px solid var(--surface-raised);
  border-radius: 99px;
  background: var(--warm);
  color: #fff;
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
}

/* Recipe detail */
.recipe-detail-view {
  width: 100%;
  max-width: 780px;
  margin: -74px auto 0;
  background: var(--bg);
}

.detail-hero {
  position: relative;
  overflow: hidden;
  height: min(72vh, 680px);
  min-height: 520px;
  background: var(--bg-deep);
}

.detail-hero > img { width: 100%; height: 100%; object-fit: cover; }

.detail-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(18,20,17,.16), transparent 35%, rgba(18,20,17,.72));
}

.detail-nav {
  position: absolute;
  z-index: 2;
  top: max(20px, env(safe-area-inset-top));
  right: 20px;
  left: 20px;
  display: flex;
  justify-content: space-between;
}

.glass-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 50%;
  background: rgba(22,24,21,.28);
  color: #fff;
  backdrop-filter: blur(16px);
}

.glass-button svg { width: 19px; }
.glass-button.is-saved svg { fill: #fff; }

.detail-title-wrap {
  position: absolute;
  z-index: 2;
  right: clamp(22px, 5vw, 46px);
  bottom: 42px;
  left: clamp(22px, 5vw, 46px);
  color: #fff;
}

.detail-title-wrap p { color: rgba(255,255,255,.72); }
.detail-title-wrap h1 { margin: 0; font-size: clamp(37px, 7vw, 57px); font-weight: 690; letter-spacing: -.06em; line-height: 1.12; }

.detail-content { padding: 0 clamp(22px, 5vw, 46px) 115px; }

.detail-lead {
  margin: 0;
  padding: 39px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: clamp(16px, 2.4vw, 18px);
  line-height: 1.75;
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 28px 0;
  border-bottom: 1px solid var(--line-strong);
}

.detail-stats span {
  display: grid;
  grid-template-columns: 25px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  padding-left: clamp(10px, 3vw, 24px);
  border-left: 1px solid var(--line);
}

.detail-stats span:first-child { padding-left: 0; border-left: 0; }
.detail-stats svg { grid-row: 1 / 3; width: 18px; color: var(--accent); }
.detail-stats small { color: var(--muted-2); font-size: 10px; }
.detail-stats strong { margin-top: 1px; font-size: 14px; font-weight: 650; }

.detail-section { padding: 60px 0 8px; }

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

.detail-section-heading p { margin-bottom: 7px; }

.serving-change {
  color: var(--muted);
  font-size: 11px;
  transition: color 180ms ease;
}

.serving-change.is-updated { color: var(--accent); }

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  background: var(--bg-deep);
}

.segmented button {
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 570;
  transition: background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.segmented button.is-active {
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: 0 2px 9px rgba(34, 37, 32, .07);
}

.ingredient-list { border-top: 1px solid var(--line-strong); }

.ingredient-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.ingredient-row input { position: absolute; opacity: 0; }
.ingredient-row .ingredient-check { display: grid; place-items: center; width: 20px; height: 20px; border: 1.5px solid var(--line-strong); border-radius: 50%; }
.ingredient-row .ingredient-check svg { width: 12px; color: transparent; }
.ingredient-row input:checked + .ingredient-check { border-color: var(--accent); background: var(--accent); }
.ingredient-row input:checked + .ingredient-check svg { color: var(--accent-ink); }
.ingredient-row input:checked ~ span { color: var(--muted-2); text-decoration: line-through; }
.ingredient-row > span:nth-last-child(2) { font-size: 15px; }
.ingredient-amount { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.ingredient-amount.flash { animation: amount-flash 380ms ease; }

@keyframes amount-flash { 0%,100%{opacity:1} 50%{opacity:.2; transform: translateY(-2px)} }

.unit-note { display: flex; align-items: center; gap: 6px; margin: 13px 0 0; color: var(--muted-2); font-size: 11px; }
.unit-note svg { width: 13px; }

.conversion-section {
  margin: 65px calc(clamp(22px, 5vw, 46px) * -1) 0;
  padding: 42px clamp(22px, 5vw, 46px) 46px;
  background: var(--accent-soft);
}

.conversion-scroll {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.conversion-scroll button {
  display: grid;
  grid-template-columns: 37px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 77px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 13%, transparent);
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface-raised) 55%, transparent);
  text-align: left;
  transition: transform 130ms ease, background 180ms ease;
}

.conversion-scroll button:active { transform: scale(.98); }
.conversion-scroll button > svg { width: 19px; color: var(--accent); }
.conversion-scroll button > span { font-size: 13px; font-weight: 620; }
.conversion-scroll small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 450; }

.method-section { padding-top: 68px; }

.step-list { margin: 0; padding: 0; list-style: none; counter-reset: steps; border-top: 1px solid var(--line-strong); }

.step-list li {
  position: relative;
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 4px;
  padding: 29px 0;
  border-bottom: 1px solid var(--line);
  counter-increment: steps;
}

.step-list li::before {
  color: var(--accent);
  font-size: 11px;
  font-weight: 720;
  letter-spacing: .08em;
  content: "STEP " counter(steps, decimal-leading-zero);
}

.step-list p { margin: 0; font-size: 16px; line-height: 1.7; }
.step-list small { display: inline-flex; align-items: center; gap: 4px; margin-top: 11px; color: var(--muted); font-size: 11px; }
.step-list small svg { width: 13px; }

.source-note {
  display: grid;
  grid-template-columns: 39px 1fr 20px;
  align-items: center;
  gap: 12px;
  margin-top: 62px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}

.source-note > svg:first-child { width: 17px; color: var(--accent); }
.source-note > svg:last-child { width: 15px; color: var(--muted-2); }
.source-note small { display: block; color: var(--muted-2); font-size: 9px; }
.source-note strong { display: block; overflow: hidden; font-size: 12px; font-weight: 580; text-overflow: ellipsis; white-space: nowrap; }

.detail-cta {
  position: fixed;
  z-index: 35;
  right: 50%;
  bottom: calc(12px + var(--safe-bottom));
  width: min(calc(100% - 24px), 610px);
  transform: translateX(50%);
}

.detail-cta .primary-button { width: 100%; min-height: 58px; border-radius: 17px; }

/* Modal and sheets */
.modal-backdrop,
.mini-sheet-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-top: max(20px, env(safe-area-inset-top));
  background: rgba(19, 21, 18, .54);
  backdrop-filter: blur(7px);
}

.modal-backdrop[hidden],
.mini-sheet-backdrop[hidden],
.cooking-mode[hidden] { display: none; }

.processing-sheet,
.mini-sheet {
  position: relative;
  overflow-y: auto;
  width: min(100%, 560px);
  max-height: calc(100dvh - 20px);
  padding: 28px clamp(24px, 6vw, 44px) calc(34px + var(--safe-bottom));
  border-radius: 28px 28px 0 0;
  background: var(--surface-raised);
  animation: sheet-up 480ms cubic-bezier(.16,1,.3,1) both;
}

@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

.sheet-close {
  position: absolute;
  z-index: 2;
  top: 20px;
  right: 20px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--bg-deep);
  color: var(--muted);
}

.sheet-close svg { width: 17px; }

.processing-visual {
  position: relative;
  display: grid;
  overflow: hidden;
  place-items: center;
  width: 92px;
  height: 92px;
  margin: 4px 0 28px;
  border: 1px solid var(--line);
  border-radius: 25px;
  background: var(--accent-soft);
  color: var(--accent);
}

.processing-visual > svg { width: 31px; stroke-width: 1.4; }

.processing-visual em {
  position: absolute;
  width: 70px;
  height: 70px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: 50%;
  animation: breathe 2s ease-in-out infinite;
}

@keyframes breathe { 0%,100%{transform:scale(.75);opacity:.3} 50%{transform:scale(1.2);opacity:.8} }

.scan-line {
  position: absolute;
  z-index: 2;
  right: 12px;
  left: 12px;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: scan 2.1s ease-in-out infinite;
}

@keyframes scan { 0%,100%{transform:translateY(-30px);opacity:.3} 50%{transform:translateY(30px);opacity:1} }

.processing-sheet h2,
.mini-sheet h2 {
  margin: 0;
  font-size: clamp(30px, 7vw, 39px);
  font-weight: 690;
  letter-spacing: -.055em;
  line-height: 1.2;
}

.processing-copy,
.mini-sheet > p:not(.eyebrow) { margin: 15px 0 28px; color: var(--muted); font-size: 14px; line-height: 1.65; }

.processing-steps { position: relative; margin-top: 29px; }

.processing-steps > div {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  min-height: 65px;
  opacity: .42;
  transition: opacity 300ms ease;
}

.processing-steps > div.is-active,
.processing-steps > div.is-done { opacity: 1; }

.processing-steps > div > span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface-raised);
  color: transparent;
}

.processing-steps > div:not(:last-child) > span::after {
  position: absolute;
  top: 25px;
  width: 1px;
  height: 39px;
  background: var(--line-strong);
  content: "";
}

.processing-steps > div.is-active > span { border-color: var(--accent); box-shadow: inset 0 0 0 6px var(--accent-soft); }
.processing-steps > div.is-done > span { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.processing-steps svg { width: 13px; }
.processing-steps p { margin: 1px 0 0; }
.processing-steps strong { display: block; font-size: 14px; font-weight: 630; }
.processing-steps small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }

.processing-bar { overflow: hidden; height: 3px; margin-top: 12px; border-radius: 99px; background: var(--bg-deep); }
.processing-bar span { display: block; width: 9%; height: 100%; background: var(--accent); transition: width 700ms cubic-bezier(.2,.8,.2,1); }
.processing-time { display: block; margin-top: 10px; color: var(--muted-2); font-size: 10px; text-align: center; }

.sheet-handle { width: 36px; height: 4px; margin: -11px auto 27px; border-radius: 99px; background: var(--line-strong); }
.sheet-icon { display: grid; place-items: center; width: 50px; height: 50px; margin-bottom: 24px; border-radius: 15px; background: var(--accent-soft); color: var(--accent); }
.sheet-icon svg { width: 23px; }
.change-preview { display: grid; grid-template-columns: 1fr 18px 1fr; align-items: center; gap: 8px; margin: 26px 0; padding: 19px; border-radius: 13px; background: var(--bg-deep); font-size: 12px; text-align: center; }
.change-preview span { color: var(--muted); }
.change-preview svg { width: 16px; color: var(--muted-2); }
.change-preview strong { color: var(--accent); font-weight: 670; }
.mini-sheet .primary-button { width: 100%; }

.toast {
  position: fixed;
  z-index: 150;
  right: 50%;
  bottom: calc(94px + var(--safe-bottom));
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: calc(100% - 36px);
  padding: 13px 17px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 13px;
  background: #252a25;
  color: #f7f6f0;
  box-shadow: var(--shadow-soft);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(50%, 12px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.toast.is-visible { opacity: 1; transform: translate(50%, 0); }
.toast svg { width: 17px; color: #b8cfbd; }

/* Cooking mode */
.cooking-mode {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100dvh;
  background: #f3f0e7;
  color: #1d201d;
  animation: cooking-in 450ms cubic-bezier(.16,1,.3,1) both;
}

.cooking-mode.is-dim { background: #171a17; color: #efeee6; }

@keyframes cooking-in { from { opacity:0; transform:scale(.985); } to { opacity:1; transform:scale(1); } }

.cooking-mode header {
  display: flex;
  justify-content: space-between;
  padding: max(18px, env(safe-area-inset-top)) clamp(20px, 4vw, 42px) 12px;
}

.cooking-mode header button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 11px;
  background: rgba(31,34,30,.07);
  font-size: 12px;
}

.cooking-mode.is-dim header button { background: rgba(255,255,255,.07); }
.cooking-mode header svg { width: 18px; }

.cooking-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 20px clamp(25px, 7vw, 74px);
}

.cooking-progress-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 11px;
  color: #2f5042;
  font-size: 12px;
  font-weight: 720;
  letter-spacing: .13em;
}

.is-dim .cooking-progress-label { color: #a7c1af; }
.cooking-progress-label em { color: #9b9c94; font-style: normal; }

.cooking-progress { overflow: hidden; height: 3px; border-radius: 99px; background: rgba(31,34,30,.12); }
.is-dim .cooking-progress { background: rgba(255,255,255,.12); }
.cooking-progress span { display: block; width: 28.5%; height: 100%; background: #2f5042; transition: width 380ms ease; }
.is-dim .cooking-progress span { background: #a7c1af; }

.cooking-step-body { padding: clamp(47px, 8vh, 88px) 0; }

.cooking-time {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 24px;
  padding: 8px 11px;
  border-radius: 9px;
  background: rgba(47,80,66,.09);
  color: #2f5042;
  font-size: 12px;
  font-weight: 650;
}

.is-dim .cooking-time { background: rgba(167,193,175,.11); color: #b0c8b7; }
.cooking-time svg { width: 16px; }

.cooking-step-body h2 {
  max-width: 870px;
  margin: 0;
  font-size: clamp(38px, 7vw, 72px);
  font-weight: 630;
  letter-spacing: -.06em;
  line-height: 1.24;
}

.cooking-step-body > p { max-width: 680px; margin: 28px 0 0; color: #6f716a; font-size: clamp(14px, 2vw, 18px); line-height: 1.7; }
.is-dim .cooking-step-body > p { color: #9c9f96; }

.cooking-mode footer {
  display: grid;
  grid-template-columns: minmax(100px, .65fr) minmax(160px, 1.35fr);
  gap: 10px;
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 12px clamp(20px, 4vw, 42px) calc(17px + var(--safe-bottom));
}

.cooking-mode footer button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 60px;
  border-radius: 15px;
  font-size: 14px;
  font-weight: 650;
}

.cooking-mode footer svg { width: 18px; }
.cooking-prev { border: 1px solid rgba(31,34,30,.14); background: transparent; }
.is-dim .cooking-prev { border-color: rgba(255,255,255,.15); }
.cooking-next { border: 0; background: #2f5042; color: #f4f4eb; }
.cooking-prev:disabled { opacity: .35; cursor: default; }

@media (max-width: 700px) {
  .topbar { height: 66px; padding-inline: 20px; }
  .home-hero { padding-top: 50px; }
  .home-hero h1 { font-size: clamp(36px, 10.5vw, 46px); }
  .hero-copy { max-width: 310px; line-height: 1.65; }
  .recipe-grid { grid-template-columns: 1.28fr .82fr; overflow: hidden; margin-right: -22px; padding-right: 22px; }
  .recipe-card:nth-child(3) { display: none; }
  .recipe-image-wrap { aspect-ratio: 1 / 1.22; }
  .recipe-meta strong { font-size: 15px; }
  .recipe-meta > span { font-size: 12px; }
  .collection-feature { grid-template-columns: 1fr; min-height: 450px; }
  .collection-copy { min-height: 260px; }
  .collection-still { min-height: 190px; }
  .library-item { grid-template-columns: 82px 1fr 18px; gap: 15px; }
  .library-item img { width: 82px; height: 82px; }
  .profile-stats small { font-size: 9px; }
  .recipe-detail-view { margin-top: -66px; }
  .detail-hero { height: 67vh; min-height: 500px; }
  .detail-hero > img { object-position: 58% center; }
  .detail-stats span { grid-template-columns: 1fr; text-align: center; }
  .detail-stats svg { display: none; }
  .conversion-scroll { display: flex; overflow-x: auto; margin-right: -22px; padding-right: 22px; scrollbar-width: none; }
  .conversion-scroll button { flex: 0 0 170px; }
  .conversion-scroll::-webkit-scrollbar { display: none; }
  .step-list li { grid-template-columns: 54px 1fr; }
  .cooking-step-body h2 { font-size: clamp(37px, 11vw, 53px); }
  .cooking-step-body br { display: none; }
}

@media (min-width: 900px) {
  .bottom-nav { width: 510px; }
  .page-intro { max-width: 780px; }
  .library-tools, .library-list, .shopping-groups, .settings-list { max-width: 820px; }
  .shopping-progress { max-width: 728px; }
  .profile-stats { max-width: 728px; }
  .processing-sheet, .mini-sheet { margin-bottom: 24px; border-radius: 28px; }
  .modal-backdrop, .mini-sheet-backdrop { align-items: center; padding: 24px; }
}

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