#planner-app {
  --gtp-paper: #fffcf6;
  --gtp-chosen: var(--plum, #493553);
  color: var(--ink, #352d36);
}
#planner-app [hidden] { display: none !important; }
.plan-settings {
  margin-bottom: 22px;
  padding-bottom: 19px;
  border-bottom: 1px solid var(--line);
}
.plan-fields { display:grid; gap:16px; }
.plan-field { margin:0; padding:0; border:0; min-inline-size:0; }
.plan-field legend,.foods-to-skip legend { padding:0; font-size:15px; font-weight:650; margin-bottom:8px; color:var(--deep); }
.plan-choices { display:flex; flex-wrap:wrap; gap:8px; }
.plan-choice {
  position:relative; display:inline-flex; align-items:center; gap:9px; min-height:46px;
  padding:9px 16px; border:1px solid #bcacc1; border-radius:22px; background:#fffcf6;
  color:var(--deep); font-size:.96rem; font-weight:600; cursor:pointer;
}
.plan-choice input { position:absolute; width:1px; height:1px; opacity:0; }
.choice-mark { display:grid; place-items:center; width:16px; height:16px; flex:none; border:1px solid #9f89a8; border-radius:50%; }
.plan-choice:has(:checked) { background:#60446c; border-color:#60446c; color:#fffaf1; }
.plan-choice:has(:checked) .choice-mark { background:#fffaf1; border-color:#fffaf1; }
.plan-choice:has(:checked) .choice-mark::before { content:""; width:8px; height:4px; border:solid #60446c; border-width:0 0 2px 2px; transform:translateY(-1px) rotate(-45deg); }
.plan-choice:has(:focus-visible),.food-check input:focus-visible,.more-foods summary:focus-visible { outline:3px solid var(--plum); outline-offset:3px; }
@media(hover:hover) { .plan-choice:hover { box-shadow:0 2px 8px #51345c26; border-color:#72527c; } }
@media(max-width:580px) { .plan-choices { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); } .plan-choice { padding:9px 10px; border-radius:14px; line-height:1.3; } }
.plan-tip { margin: 10px 0 0; max-width: 74ch; font-size: 15px; color: var(--muted); line-height: 1.6; }
.foods-to-skip { min-inline-size: 0; border: 0; padding: 0; margin: 15px 0 0; }
.food-checks { display: flex; flex-wrap: wrap; gap: 7px; }
.food-check { display: inline-flex; align-items: center; gap: 7px; min-height: 42px; border: 1px solid var(--line); padding: 5px 11px; background: #fffdf9; border-radius: 8px; color: var(--ink); cursor: pointer; font-size: 14px; }
.food-check input { margin: 0; accent-color: var(--plum); width: 16px; height: 16px; }
.food-check:has(:checked) { border-color: var(--plum); background: var(--lavender); }
.more-foods summary { padding: 8px 0; width: fit-content; color: var(--plum); font-size: 14px; font-weight: 600; cursor: pointer; }
.plan-empty { padding: 14px 0; color: var(--muted); }
.plan-library { display: inline-block; margin-block: 0 12px; text-decoration: underline; color: var(--plum); }
.gtp-photo { width: 100%; height: auto; aspect-ratio: 1.6; border-radius: 12px; object-fit: cover; margin-bottom: 14px; }

.gtp-layout {
  border: 1px solid var(--line, #dcd4da);
  border-radius: 20px;
  padding: clamp(12px, 2.8vw, 34px);
  background: var(--gtp-paper);
}

.gtp-layout *,
.gtp-layout *::before,
.gtp-layout *::after {
  box-sizing: border-box;
}

.gtp-months {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.gtp-month,
.gtp-day {
  appearance: none;
  margin: 0;
  font: inherit;
  color: var(--ink, #352d36);
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.gtp-month:focus-visible,
.gtp-day:focus-visible,
.gtp-recipe:focus-visible {
  outline: 3px solid #774e88;
  outline-offset: 3px;
}

.gtp-month {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--line, #dcd4da);
  border-radius: 12px;
  padding: clamp(12px, 2vw, 22px);
  text-align: start;
  background: transparent;
}

.gtp-month[aria-pressed="true"] {
  border-color: var(--gtp-chosen);
  background: var(--gtp-chosen);
  color: white;
}

.gtp-month-label,
.gtp-period {
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.065em;
  line-height: 1.5;
  text-transform: uppercase;
}

.gtp-month-label {
  color: var(--muted, #625b63);
}

.gtp-month[aria-pressed="true"] .gtp-month-label {
  color: #f0e4f2;
}

.gtp-month-name {
  font-family: inherit;
  font-size: clamp(1rem, 2.1vw, 1.32rem);
  font-weight: 600;
  line-height: 1.25;
}

.gtp-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin-block: clamp(17px, 2.4vw, 28px) 0;
  border-bottom: 1px solid var(--line, #dcd4da);
}

.gtp-day {
  position: relative;
  display: block;
  min-height: 44px;
  padding: 8px 1px 10px;
  border: 0;
  border-bottom: 3px solid transparent;
  text-align: center;
  font-size: 0.84rem;
  font-weight: 550;
  line-height: 1.35;
  background: transparent;
  color: var(--muted, #625b63);
}

.gtp-day[aria-pressed="true"] {
  border-bottom-color: var(--gtp-chosen);
  font-weight: 700;
  color: var(--gtp-chosen);
}

.gtp-day-short {
  display: none;
}

.gtp-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 26px);
  margin-block: 24px;
}

.gtp-meal {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-inline: 0;
}

.gtp-meal:first-child {
  padding-inline-start: 0;
}

.gtp-meal:last-child {
  padding-inline-end: 0;
}


.gtp-period {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gtp-chosen);
}

.gtp-marker {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #bd8b4c;
}

.gtp-meal:nth-child(2) .gtp-marker {
  background: #798863;
}

.gtp-meal:nth-child(3) .gtp-marker {
  background: #926f9f;
}

#planner-app .gtp-name {
  margin: 9px 0 7px;
  font-size: clamp(1.27rem, 2.25vw, 1.75rem);
  font-weight: 550;
  line-height: 1.2;
  color: var(--ink, #352d36);
  text-wrap: pretty;
}

#planner-app .gtp-prep,
#planner-app .gtp-note {
  margin: 0;
  color: var(--muted, #625b63);
  line-height: 1.6;
}

#planner-app .gtp-prep {
  flex-grow: 1;
  font-size: 0.96rem;
}

.gtp-recipe {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-top: 14px;
  padding: 7px 15px;
  border: 1px solid #d9cbdf;
  border-radius: 24px;
  background: #f5eff6;
  color: var(--gtp-chosen);
  font: inherit;
  font-size: .88rem;
  font-weight: 650;
  line-height: 1.4;
}

.gtp-recipe-arrow {
  font-family: Arial, sans-serif;
  font-size: 1.15em;
}
.meal-swap {
  align-self: flex-start;
  margin-top: 6px;
  padding: 8px 1px;
  min-height: 44px;
  background: transparent;
  color: var(--deep);
  font-size: .91rem;
  font-weight: 600;
  text-align: start;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.only-choice { margin-top: 8px; color: var(--muted); font-size: .88rem; }
.week-table-link { display:inline-block; padding:7px 0; color:var(--deep); text-decoration:underline; text-underline-offset:3px; }
.gtp-layout:has(.gtp-months[hidden]) .week-table-link { display:none; }
.week-table-wrap {
  margin-block:20px 28px;
  scroll-margin-top:5.5rem;
  border:1px solid #d8cbdb;
  border-radius:22px;
  overflow:hidden;
  background:#fffcf6;
  box-shadow:0 12px 32px #41274b10;
}
.weekly-diet-table { width:100%; border-spacing:0; table-layout:fixed; color:var(--deep); }
.week-heading {
  position:relative;
  isolation:isolate;
  overflow:hidden;
  text-align:start;
  padding:24px clamp(18px,3vw,36px);
  background:linear-gradient(105deg,#46304f,#654872 78%,#816489);
  color:#fff7e8;
}
/* Concentric rims echo a place setting along the edge of the menu. */
.week-heading::after {
  content:"";
  position:absolute;
  z-index:-1;
  inset-inline-end:-45px;
  inset-block-start:-36px;
  width:190px;
  aspect-ratio:1;
  border-radius:50%;
  background:repeating-radial-gradient(circle,transparent 0 14px,#fff0d829 15px 16px,transparent 17px 22px);
  pointer-events:none;
}
.week-heading-copy { position:relative; }
.week-context { display:block; font-size:.84rem; font-weight:600; color:#f4e2ee; }
#planner-app .week-title { color:inherit; margin:4px 0 0; font:normal clamp(1.8rem,3.2vw,2.8rem)/1.18 var(--serif); }
.weekly-diet-table th,.weekly-diet-table td { text-align:start; vertical-align:middle; }
.weekly-diet-table thead th {
  padding:12px 14px;
  background:#efe6f2;
  color:#593f65;
  font-size:.9rem;
  border-bottom:1px solid #ddcfdf;
}
.weekly-diet-table thead th:first-child { width:16%; }
.week-day-row { background:#fffcf6; }
.week-day-row:nth-child(even) { background:#f8f3f6; }
.week-day-row > * { border-bottom:1px solid #e8dfe5; }
.week-day-row:last-child > * { border-bottom:0; }
.week-day-row th { padding:13px; font:600 1.08rem/1.25 var(--serif); overflow-wrap:anywhere; }
.week-selected th { border-inline-start:4px solid #80588e; background:#e9deed; }
.week-day-row td { padding:7px 4px; }
.week-day-row td:last-child { padding-inline-end:10px; }
.week-dish {
  display:flex; align-items:center; gap:10px; width:100%; min-height:58px;
  padding:6px; border:1px solid transparent; border-radius:13px;
  background:transparent; color:#422f4c; text-align:start; font:inherit;
  font-size:.96rem; line-height:1.35; cursor:pointer;
}
.week-dish-photo { flex:none; width:46px; height:46px; object-fit:cover; border-radius:13px; border:1px solid #40304419; }
.week-dish-name { overflow-wrap:anywhere; }
.week-empty { display:block; padding:8px; }
.week-period { display:none; }
.week-dish:focus-visible { outline:3px solid #715180; outline-offset:-2px; background:#fff; }
@media (hover:hover) {
  .week-dish:hover { background:#fff; border-color:#d4bfd9; box-shadow:0 3px 10px #452c5111; }
}
@media (max-width:720px) {
  .weekly-diet-table,.weekly-diet-table caption,.weekly-diet-table tbody { display:block; }
  .weekly-diet-table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
  .week-day-row { display:grid; padding:10px 14px 14px; }
  .week-day-row + .week-day-row { border-top:1px solid #ded1e0; }
  .week-day-row > * { border-bottom:0; }
  .week-day-row th { width:fit-content; padding:5px 0; font-size:1.32rem; }
  .week-selected th { border:0; background:transparent; color:#694275; }
  .week-selected th::after { content:""; display:inline-block; width:7px; height:7px; border-radius:50%; margin-inline-start:9px; vertical-align:middle; background:#896296; }
  .week-day-row td,.week-day-row td:last-child { position:relative; padding:0; }
  .week-dish { position:relative; min-height:66px; padding:23px 9px 6px; padding-inline-start:68px; }
  .week-dish-photo { position:absolute; inset-inline-start:7px; top:50%; margin-top:-23px; }
  .week-period { display:block; position:absolute; z-index:1; inset-inline-start:68px; top:6px; color:#705674; font-size:.76rem; font-weight:600; pointer-events:none; }
  .week-empty { padding:26px 8px 10px; padding-inline-start:68px; }
}
.dessert-intro { margin-top: 38px; margin-bottom: 18px; }
.dessert-intro h2 { font-size: clamp(30px,3.4vw,45px); line-height: 1.15; margin-bottom: 6px; }
.dessert-intro p { color: var(--muted); max-width: 750px; }
.other-days summary { color: var(--deep); font-weight: 600; cursor: pointer; padding: 9px 0; }
.other-days[open] summary { margin-bottom: 8px; }
#detail-body .meal-idea p+p { margin-top:8px; }

#planner-app .gtp-note {
  padding-block-start: 14px;
  border-top: 1px solid var(--line, #dcd4da);
  font-size: 0.85rem;
}

#planner-app[lang="ar"] .gtp-month-label,
#planner-app[lang="ar"] .gtp-period {
  letter-spacing: 0;
}

@media (hover: hover) {
  .gtp-recipe:hover {
    border-color: var(--gtp-chosen);
    background: var(--gtp-chosen);
    color: white;
  }

  .gtp-month[aria-pressed="false"]:hover,
  .gtp-day[aria-pressed="false"]:hover {
    background: var(--lavender, #eee5f2);
    color: var(--gtp-chosen);
  }
}

@media (max-width: 760px) {
  .gtp-day-long {
    display: none;
  }
  .gtp-day-short {
    display: inline;
  }
}

@media (max-width: 580px) {
  .gtp-months {
    gap: 5px;
  }
  .gtp-month {
    justify-content: flex-start;
    gap: 4px;
    padding: 11px 7px;
    border-radius: 8px;
  }
  .gtp-month-name {
    font-size: 0.92rem;
  }
  .gtp-days {
    gap: 0;
  }
  .gtp-day {
    font-size: 0.76rem;
  }
  #planner-app[lang="ar"] .gtp-day {
    font-size: 0.70rem;
  }
  .gtp-grid {
    grid-template-columns: 1fr;
    gap: 0;
    margin-block: 4px 0;
  }
  .gtp-meal,
  .gtp-meal:first-child,
  .gtp-meal:last-child {
    padding: 16px 0;
  }
  .gtp-meal + .gtp-meal {
    border-inline-start: 0;
    border-top: 1px solid var(--line, #dcd4da);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gtp-month,
  .gtp-day {
    transition: none;
  }
}
.week-swap { margin:0 8px 4px; padding:6px 12px; color:#5a3765; background:#f0e6f1; border:1px solid #d9c8de; border-radius:12px; font:inherit; font-size:.82rem; } @media(max-width:720px){.week-swap{margin-inline-start:68px;}}

/* =====================================================================
   Phone polish: bigger tap targets, readable small text, swipeable
   recipe rows, a shorter planner and pop-ups that rise as a sheet.
   ===================================================================== */
@media (max-width: 670px) {
  /* Header controls reach a comfortable 44px tap size. */
  .lang-btn, .menu-btn { min-width: 44px; min-height: 44px; }
  .menu-btn { width: 44px; margin-inline-end: -9px; }
  .topbar .support-link { min-height: 40px; padding-inline: 14px; }
  .nav-links.is-open a, .nav-links.is-open .motion-button { min-height: 44px; display: flex; align-items: center; }

  /* Small labels stay readable. */
  .eyebrow { font-size: 11px; }
  .tag-text small { font-size: 11px; }
  .card-action { font-size: 13px; }

  /* Text links get taller tap areas without changing how they look. */
  .story-link, .back-top, .week-table-link { padding-block: 12px; }
  .footer-nav a { min-height: 44px; display: inline-flex; align-items: center; padding-block: 0; }

  /* Hero: a little tighter so the first meal button shows sooner. */
  .hero-layout { gap: 22px; padding-block: 22px 30px; }
  .hero-facts { margin-top: 20px; padding-top: 14px; }

  /* Recipe and dessert rows swipe sideways instead of stacking 18 cards. */
  .recipe-grid {
    display: grid;
    grid-auto-flow: column;
    grid-template-columns: none;
    grid-auto-columns: 74%;
    gap: 12px;
    margin-inline: -19px;
    padding: 4px 19px 14px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 19px;
    scrollbar-width: thin;
    scrollbar-color: #cbb9d1 transparent;
  }
  .recipe-grid > .recipe-card { scroll-snap-align: start; display: flex; flex-direction: column; }
  .recipe-grid > .recipe-card > img { height: auto; min-height: 0; aspect-ratio: 1.35; }
  .recipe-grid .recipe-info { flex: 1; align-items: flex-end; padding: 13px 14px 15px; }
  .recipe-grid .recipe-info h3 { font-size: 21px; }
  .recipe-grid .round-arrow { width: 34px; height: 34px; }
  .dessert-intro { margin: 30px 0 14px; }
  .recipe-book { margin-top: 16px; }

  /* Planner: shorter meal photos and one-line rows in the weekly table. */
  .gtp-photo { aspect-ratio: 2.1; }
  .week-day-row td { display: flex; align-items: center; gap: 6px; }
  .week-day-row td .week-dish { flex: 1; min-width: 0; }
  .week-swap, .week-swap:only-child { margin: 0; margin-inline-end: 4px; min-height: 40px; padding-inline: 12px; flex: none; }
  .meal-swap { min-height: 44px; }

  /* Pop-ups rise from the bottom as a sheet with a grab handle. */
  dialog {
    width: 100%;
    max-width: 100%;
    max-height: 92dvh;
    margin: auto 0 0;
    border-radius: 22px 22px 0 0;
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  dialog::before {
    content: "";
    position: sticky;
    top: 0;
    z-index: 3;
    display: block;
    width: 40px;
    height: 4px;
    margin: 8px auto -12px;
    border-radius: 4px;
    background: #d3c4d8;
  }
  .dialog-close { width: 44px; height: 44px; top: 10px; margin: 10px 10px -54px; }

  /* Floating button clears the phone's home bar. */
  .to-top { inset-inline-end: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); }
}
@media (max-width: 670px) {
  html[data-motion="on"] dialog[open] { animation: sheet-up 420ms cubic-bezier(.2, .75, .25, 1); }
}
@keyframes sheet-up {
  from { translate: 0 60px; opacity: 0; }
  to { translate: 0 0; opacity: 1; }
}

/* Weekly table folds to the selected day on phones. */
.week-toggle { display: none; }
@media (max-width: 670px) {
  .week-table-wrap.is-folded .week-day-row:not(.week-selected) { display: none; }
  .week-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 28px);
    min-height: 48px;
    margin: 4px 14px 14px;
    border: 1px solid #d9c8de;
    border-radius: 14px;
    background: #f3ecf5;
    color: var(--deep);
    font: 600 15px/1.2 var(--sans);
  }
  .week-toggle:active { background: #e8dced; }
  .week-toggle-chevron {
    width: 8px;
    height: 8px;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    rotate: 45deg;
    translate: 0 -2px;
    transition: rotate 300ms cubic-bezier(.2,.75,.25,1), translate 300ms;
  }
  .week-toggle[aria-expanded="true"] .week-toggle-chevron { rotate: 225deg; translate: 0 2px; }
}

/* Trial accent: today's row in the weekly table */
.week-selected th { border-inline-start-color: var(--accent, #80588e); }
@media (max-width: 720px) { .week-selected th::after { background: var(--accent, #896296); } }
.gtp-day[aria-pressed="true"] { border-bottom-color: var(--accent, var(--gtp-chosen)); }

/* The narrowest phones use a 15px side margin, so the swipe rows bleed by 15px there. */
@media (max-width: 380px) {
  .recipe-grid { margin-inline: -15px; padding-inline: 15px; scroll-padding-inline: 15px; }
}

/* "Something sweet?" · an even grid of same-size choices instead of uneven rows. */
.sweet-choices {
  padding: 14px 0 20px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  align-items: stretch;
}
.sweet-choices > h3, .sweet-choices > p { grid-column: 1 / -1; margin-bottom: 2px; }
.sweet-choice {
  background: var(--cream);
  color: var(--deep);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 60px;
  padding: 6px;
  padding-inline-end: 12px;
  border-radius: 14px;
  text-align: start;
  line-height: 1.3;
}
.sweet-choice .food-thumb { flex: none; width: 46px; height: 46px; border-radius: 11px; object-fit: cover; }
.sweet-choice span { min-width: 0; overflow-wrap: anywhere; }
[data-motion="on"] .sweet-choice:hover { translate: none; }

@media (max-width: 760px) {
  .sweet-choices { grid-template-columns: 1fr 1fr; gap: 8px; }
  .sweet-choices > h3 { font-size: 22px; }
  .sweet-choice { min-height: 58px; padding: 5px; padding-inline-end: 8px; gap: 8px; font-size: 13.5px; }
  [dir="rtl"] .sweet-choice { font-size: 14.5px; }
  .sweet-choice .food-thumb { width: 44px; height: 44px; border-radius: 10px; }
}
@media (max-width: 340px) { .sweet-choices { grid-template-columns: 1fr; } }
