.back-link,
.section-kicker,
.meal-meta,
.meal-number,
.form-hint {
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.1em;
}

.back-link {
  color: var(--muted);
  font-size: 11px;
  text-decoration: none;
}

.back-link span {
  margin-left: 6px;
  color: var(--accent);
}

.planner-main {
  display: block;
  padding: 66px 0 90px;
}

.planner-intro {
  margin-bottom: 42px;
}

.planner-title {
  font-size: clamp(54px, 7vw, 84px);
  line-height: 1;
}

.planner-intro .intro {
  margin-top: 16px;
}

.meal-form {
  padding: 26px 28px 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: 24px;
}

.meal-form label {
  display: block;
  margin-bottom: 17px;
  font-size: 17px;
  font-weight: 600;
}

.form-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.meal-picker {
  display: flex;
  align-items: center;
  gap: 22px;
  flex: 1;
  max-width: 430px;
}

.dial-display {
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--green);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
}

.dial-display output {
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1;
}

.dial-display span {
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.range-control {
  flex: 1;
  min-width: 120px;
}

.range-control input {
  display: block;
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.range-control input:focus-visible,
.primary-button:focus-visible,
.refresh-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.primary-button {
  min-height: 48px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--green);
  color: var(--white);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.primary-button:hover {
  transform: translateY(-1px);
  background: var(--glacier);
}

.primary-button span {
  margin-left: 12px;
  color: var(--accent-soft);
}

.form-hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
}

.ideas-section {
  margin-top: 52px;
}

.ideas-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 8px;
}

.section-kicker {
  color: var(--muted);
  font-size: 11px;
}

.ideas-header h2 {
  margin: 9px 0 0;
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.refresh-button {
  padding: 8px 0 8px 12px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.refresh-button span {
  margin-right: 5px;
  font-size: 17px;
}

.results-status {
  min-height: 21px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.meal-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.meal-item {
  min-height: 154px;
  padding: 0;
  overflow: hidden;
  background: var(--white);
  border: 1px solid rgba(27, 42, 37, 0.08);
  border-radius: 22px;
  animation: appear 600ms var(--ease-out) backwards;
}

.meal-card-toggle {
  width: 100%;
  min-height: 154px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 20px 22px;
  border: 0;
  background: var(--white);
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.meal-card-toggle:hover:not(:disabled) {
  background: #F7F5EE;
}

.meal-card-toggle[aria-pressed="true"] {
  background: var(--sage-soft);
}

.meal-card-toggle[aria-pressed="true"]:hover:not(:disabled) {
  background: #D6E3D4;
}

.meal-card-toggle:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--accent);
  outline-offset: -4px;
}

.meal-card-toggle:disabled {
  cursor: not-allowed;
}

.meal-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.meal-number {
  color: var(--accent);
  font-size: 10px;
}

.meal-meta {
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.meal-card-title {
  display: block;
  margin: 0 0 7px;
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.meal-card-detail {
  display: block;
  margin: 0;
  color: var(--body-text);
  font-size: 14px;
  line-height: 1.6;
}

.meal-card-action {
  margin-top: auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
  transition: background 160ms ease, color 160ms ease;
}

.meal-card-toggle[aria-pressed="true"] .meal-card-action {
  border-color: var(--green);
  background: var(--green);
  color: var(--white);
}

.selection-count {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
}

.selected-section,
.grocery-section {
  margin-top: 42px;
  padding-top: 25px;
  border-top: 1px solid var(--line);
}

.selected-section h2,
.grocery-section h2 {
  margin: 9px 0 16px;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

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

.grocery-print-button {
  min-height: 40px;
  flex: 0 0 auto;
  padding: 0 16px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.grocery-print-button span {
  margin-left: 5px;
  color: var(--accent);
}

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

.grocery-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.grocery-action-button {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.grocery-action-button span {
  margin-left: 6px;
  color: var(--accent);
}

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

.instacart-button {
  border: 0;
  background: var(--green);
  color: var(--white);
}

.instacart-button:hover {
  background: var(--ink);
}

.instacart-dialog {
  position: relative;
  width: min(580px, calc(100% - 32px));
  border-radius: 24px;
  max-height: min(90vh, 760px);
  overflow: auto;
  padding: 30px 28px 25px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--green);
  background: var(--paper);
  color: var(--ink);
}

.instacart-dialog::backdrop {
  background: rgba(24, 37, 34, 0.68);
}

#instacart-dialog [hidden] {
  display: none !important;
}

.instacart-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

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

.instacart-loading {
  text-align: center;
}

.instacart-loading > .section-kicker {
  margin: 0 0 8px;
}

.instacart-loading h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 500;
}

.instacart-scene {
  position: relative;
  width: min(100%, 390px);
  height: 245px;
  margin: 14px auto 0;
  overflow: hidden;
}

.instacart-cart {
  position: absolute;
  right: 5%;
  bottom: 1px;
  left: 5%;
  z-index: 1;
  width: 90%;
  height: 185px;
}

.falling-grocery {
  position: absolute;
  top: 0;
  z-index: 2;
  width: 48px;
  height: 52px;
  animation: grocery-drop 1.5s cubic-bezier(0.22, 0.8, 0.32, 1) both;
}

.grocery-apple {
  left: 22%;
}

.grocery-carrot {
  left: 37%;
  animation-delay: 0.3s;
}

.grocery-milk {
  left: 52%;
  animation-delay: 0.6s;
}

.grocery-bread {
  left: 67%;
  width: 58px;
  height: 44px;
  animation-delay: 0.9s;
}

.instacart-loading-copy {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.instacart-feedback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.instacart-feedback img {
  display: block;
  width: min(100%, 330px);
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
}

.instacart-feedback p {
  width: min(100%, 460px);
  margin: 0;
  padding: 16px 18px;
  border-left: 4px solid var(--accent);
  background: var(--white);
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
}

@keyframes grocery-drop {
  0% { opacity: 0; transform: translateY(-75px) rotate(-24deg); }
  18% { opacity: 1; }
  72% { transform: translateY(128px) rotate(18deg); }
  84% { transform: translateY(105px) rotate(-7deg); }
  100% { opacity: 1; transform: translateY(114px) rotate(0); }
}

.selected-meal-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.selected-meal-item {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  font-size: 14px;
}

.remove-meal-button {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}

.remove-meal-button:focus-visible,
.grocery-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.grocery-button {
  margin-top: 18px;
}

.grocery-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.grocery-section > .section-kicker {
  color: var(--muted);
  font-size: 11px;
}

.other-grocery-section {
  margin-bottom: 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--glacier);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.62);
}

.other-grocery-form > label {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 600;
}

.other-grocery-entry {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 54px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
}

.other-grocery-entry input {
  min-width: 180px;
  min-height: 38px;
  flex: 1;
  padding: 0 7px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.other-grocery-entry input:focus-visible,
.other-grocery-entry button:focus-visible,
.other-grocery-chip button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.other-grocery-entry button {
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--green);
  color: var(--white);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.other-grocery-items {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.other-grocery-chip {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px 0 12px;
  border: 1px solid rgba(62, 107, 90, 0.35);
  border-radius: 999px;
  background: var(--sage-soft);
  color: var(--ink);
  font-size: 12px;
}

.other-grocery-chip button {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}

.other-grocery-status {
  min-height: 0;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.other-grocery-status:not(:empty) {
  margin-top: 8px;
}

.grocery-view-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  width: 100%;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.grocery-view-switch .grocery-print-top-button {
  margin-left: auto;
}

.grocery-view-switch .instacart-top-button {
  margin-left: 8px;
}

.grocery-view-switch legend {
  margin-right: 12px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.grocery-view-switch label {
  position: relative;
  cursor: pointer;
}

.grocery-view-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.grocery-view-switch label > span {
  display: block;
  min-height: 36px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.grocery-view-switch label + label > span {
  border-left: 0;
}

.grocery-view-switch input:checked + span {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--white);
}

.grocery-view-switch input:focus-visible + span {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.grocery-list {
  display: grid;
  gap: 22px;
}

.grocery-print-document {
  display: none;
}

.grocery-group h3 {
  margin: 0;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
}

.grocery-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 28px;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.grocery-items li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
  color: var(--body-text);
  font-size: 13px;
  line-height: 1.5;
}

.grocery-remove-button {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
}

.grocery-items li:hover .grocery-remove-button,
.grocery-remove-button:focus-visible {
  opacity: 1;
}

.grocery-remove-button:focus-visible,
.grocery-hint button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.grocery-hint {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: min(340px, calc(100% - 40px));
  padding: 14px 14px 14px 16px;
  border-radius: 18px;
  background: var(--ink);
  color: var(--white);
  box-shadow: 0 16px 36px -12px rgba(27, 42, 37, 0.45);
}

.grocery-hint[hidden] {
  display: none;
}

.grocery-hint p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.grocery-hint button {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--white);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

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

@media (max-width: 760px) {
  .planner-title {
    font-size: 54px;
  }
}

@media (max-width: 650px) {
  .planner-main {
    padding: 48px 0 64px;
  }

  .planner-intro {
    margin-bottom: 30px;
  }

  .planner-title {
    font-size: 46px;
  }

  .meal-form {
    padding: 22px 18px;
  }

  .form-controls {
    flex-wrap: wrap;
  }

  .meal-picker {
    flex-basis: 100%;
    max-width: none;
  }

  .primary-button {
    width: 100%;
    margin-top: 5px;
  }

  .ideas-section {
    margin-top: 40px;
  }

  .ideas-header h2 {
    font-size: 24px;
  }

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

  .grocery-items {
    grid-template-columns: 1fr;
  }

  .other-grocery-entry input {
    flex-basis: 100%;
  }

  .grocery-actions {
    flex-direction: column;
  }

  .grocery-action-button {
    width: 100%;
  }

  .instacart-dialog {
    padding: 28px 16px 20px;
  }

  .instacart-scene {
    height: 220px;
  }

  .instacart-feedback p {
    font-size: 16px;
  }

  .instacart-feedback img {
    width: min(100%, 250px);
  }

  .site-footer {
    gap: 12px;
    font-size: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  @page {
    size: letter portrait;
    margin: 0.4in;
  }

  body * {
    visibility: hidden !important;
  }

  #grocery-print-document,
  #grocery-print-document * {
    visibility: visible !important;
  }

  #grocery-print-document {
    position: absolute !important;
    top: 0;
    left: 0;
    display: block !important;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: #FFFFFF;
    color: #111111;
  }

  #grocery-print-document h1 {
    margin: 0 0 14pt;
    font-size: 19pt;
    font-weight: 600;
  }

  #grocery-print-document h2 {
    margin: 0 0 4pt;
    font-size: 11pt;
    font-weight: 700;
  }

  #grocery-print-document ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  #grocery-print-document li {
    padding: 2pt 0;
    color: #111111;
    font-size: 9.5pt;
    line-height: 1.25;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  #grocery-print-document .print-grocery-group {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  #grocery-print-document .print-grocery-ingredients {
    column-count: 2;
    column-gap: 0.3in;
    column-fill: balance;
  }

  #grocery-print-document .print-grocery-divider {
    margin: 9pt 0 7pt;
    border: 0;
    border-top: 0.75pt solid #929A95;
  }
}