/* Neumorphic blue-button UI inspired by reference image */
:root{
  --bg:#eef3f8;
  --card:#eef3f8;
  --text:#2b3445;
  --muted:#7b8aa0;
  --accent:#4f8ef7;
  --accent-dark:#3b74d8;
  --accent-soft:#dbe7ff;
  --white:#ffffff;
  --shadow-light: -8px -8px 16px rgba(255,255,255,.9);
  --shadow-dark: 8px 8px 18px rgba(180,190,210,.55);
  --radius:18px;
  --safe: env(safe-area-inset-top, 0px);
  --safeB: env(safe-area-inset-bottom, 0px);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app{
  min-height:100%;
  padding: calc(16px + var(--safe)) 16px calc(18px + var(--safeB));
  max-width:520px;
  margin:0 auto;
}

.card{
  background: var(--card);
  border-radius: 24px;
  padding:16px;
  box-shadow: var(--shadow-light), var(--shadow-dark);
}

.top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  margin-bottom:14px;
}

.title h1{ margin:0; font-size:1.35rem; }
.subtitle{ margin:.25rem 0 0; color:var(--muted); }

.icon{
  width:44px;
  height:44px;
  border-radius:14px;
  border:none;
  background: var(--bg);
  box-shadow: var(--shadow-light), var(--shadow-dark);
  font-size:1.1rem;
  color:var(--muted);
}

.choices{
  margin-top:14px;
  display:flex;
  flex-direction:column;
  gap:14px;
}

/* Step 4 (start): Meal thumbnails grid */
.mealChoices{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.choice.mealTile{
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  text-align: center;
  padding: 10px 10px 12px;
  gap: 8px;
  min-height: unset;
}

.mealThumb{
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  object-fit: cover;
  display:block;
  box-shadow: 0 6px 14px rgba(0,0,0,.18);
}

.choice.mealTile .label{
  display:block;
  width:100%;
}


.choice{
  
  display:flex;
  align-items:center;
  gap:12px;
  padding: 14px 16px;
  text-align:left;

  min-height:64px;
  border-radius: 24px;
  border:none;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  box-shadow: 0 10px 22px rgba(79,142,247,.35),
              inset 0 1px 0 rgba(255,255,255,.35);
  font-size:1.05rem;
  font-weight:700;
  color: var(--white);

}

.choice:active{
  box-shadow:
    inset 6px 6px 14px rgba(0,0,0,.25),
    inset -6px -6px 14px rgba(255,255,255,.15);
}

.pill{
  font-size:.8rem;
  padding:6px 12px;
  border-radius: 24px;
  background: var(--bg);
  box-shadow: inset var(--shadow-light), inset var(--shadow-dark);
  color:var(--muted);
}

.footer button{
  min-height:46px;
  border-radius:14px;
  border:none;
  background: var(--bg);
  box-shadow: var(--shadow-light), var(--shadow-dark);
  color:var(--muted);
}

.footer button:active{
  box-shadow: inset var(--shadow-light), inset var(--shadow-dark);
  color:var(--accent);
}

.winnerName{
  font-size:1.6rem;
  font-weight:800;
  padding:14px;
  border-radius:16px;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  color: var(--white);
  text-align:center;
  box-shadow: 0 12px 26px rgba(79,142,247,.35);
}

.hidden{ display:none !important; }


/* Thumbnail layout for choice buttons */
.choice{
  border-radius: 24px;
  
  display:flex;
  align-items:center;
  gap:12px;
  padding: 14px 16px;
  text-align:left;

  display:flex;
  align-items:center;
  gap:12px;
  padding: 14px 16px;
  text-align:left;

}

.choice .thumb{
  width:40px;
  height:40px;
  border-radius:14px;
  display:grid;
  place-items:center;
  flex: 0 0 40px;
  background: rgba(255,255,255,.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
  font-size: 1.25rem;
}

.choice .label{
  display:block;
  line-height:1.15;
}


/* Real image thumbnails */
.choice .thumbimg{
  width:40px;
  height:40px;
  border-radius:14px;
  flex: 0 0 40px;
  background: rgba(255,255,255,.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
  object-fit: cover;
}

.logoWrap{
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  padding-top: 4px;
}
.logo{
  width: 360px; /* ~2x bigger */
  max-width: 90vw;
  height: auto;
  display:block;
  filter: drop-shadow(0 14px 26px rgba(0,0,0,.22));
}
/* keep reset icon aligned; make header stack nicely */
.top{
  align-items:center;
}
.title{
  flex:1;
}

/* Extra spacing between choices and footer */
.choices{
  margin-bottom: 22px;
}

.status{
  border-radius: 24px; display:none !important; }


/* Static progress row aligned with cards */
.progressShell{
  max-width: 520px;
  margin: 0 auto 10px auto;
  padding: 0 16px;
}
.progressRow{
  display:flex;
  justify-content:center;
  align-items:flex-start;
  gap: 26px;
  padding: 10px 12px;
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow-light), var(--shadow-dark);
}
.step{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap: 6px;
  min-width: 72px;
}
.dot{
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #ffffff;
  border: 2px solid rgba(229,231,235,1);
  box-shadow: 0 6px 14px rgba(0,0,0,.10);
}
.dot.done{
  background: #22c55e;
  border-color: #22c55e;
  box-shadow: 0 8px 18px rgba(34,197,94,.28);
}
.stepLabel{
  font-size: .72rem;
  color: rgba(43,52,69,.70);
}


/* Footer controls layout */
.footer{
  display:flex;
  gap:12px;
  margin-top:16px;
}
.footer button{
  flex:1;
}


/* --- Subtle haptic-style feedback --- */

/* 1) Button press / tap feel */
button, .choice{
  border-radius: 24px;
  
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 120ms ease, filter 140ms ease, box-shadow 140ms ease;
  will-change: transform, filter;

}
button:active, .choice:active{
  transform: scale(0.985);
  filter: brightness(0.96);
}

/* Prevent double-press accidental selection (still instant) */
.choice{
  border-radius: 24px;
  
  user-select: none;

}

/* 2) Selected pulse (applied via JS class) */
@keyframes microPulse{
  0%{ transform: scale(1); }
  45%{ transform: scale(1.02); }
  100%{ transform: scale(1); }
}
.choice.pulse{
  animation: microPulse 170ms ease-out;
}

/* 3) Losing option fade (applied via JS class) */
@keyframes fadeOutSoft{
  from{ opacity:1; transform: scale(1); }
  to{ opacity:0; transform: scale(0.99); }
}
.choice.fadeOut{
  animation: fadeOutSoft 140ms ease-in forwards;
}

/* 4) Progress dot pop + glow */
@keyframes dotPop{
  0%{ transform: scale(1); }
  60%{ transform: scale(1.20); }
  100%{ transform: scale(1); }
}
.dot{
  transition: background-color 180ms ease, border-color 180ms ease, box-shadow 220ms ease, transform 180ms ease;
}
.dot.done.dotPop{
  animation: dotPop 220ms ease-out;
}

/* 5) Winner reveal motion */
@keyframes winnerRise{
  from{ opacity:0; transform: translateY(6px); }
  to{ opacity:1; transform: translateY(0); }
}
#winnerName{
  animation: winnerRise 220ms ease-out;
}


/* Center subtitle under logo (Meal • Cuisine text) */
#subtitle{
  text-align: center;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}


/* Center prompt texts above buttons */
#promptTitle,
#promptDesc{
  text-align: center;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}


/* Definitive centering for prompt section (title + description above buttons) */
.prompt{
  text-align: center;
}

.prompt h2,
.prompt p{
  text-align: center;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}


/* Center winner screen prompt texts */
#winnerCard,
#winnerCard h2,
#winnerCard p,
#winnerMeta,
#winnerName{
  text-align: center;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}


/* =========================================================
   Fit-to-screen for iPhone 13 (390×844 CSS px)
   - Keep header spacing as-is
   - Keep "What's included?" visible
   - Hide subtitle/gray text under the logo
   ========================================================= */

/* Hide gray subtitle text under the logo/title */
.subtitle{ display:none !important; }

/* Use iOS-friendly viewport units */
html, body { height: 100%; }
body { overflow: hidden; }

/* Prefer dynamic viewport height on mobile Safari; fall back gracefully */
.app{
  height: 100dvh;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Let main content flex inside viewport */
.content{
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Scale paddings and button heights slightly so everything fits without scrolling */
@media (max-height: 900px){
  .card{
  border-radius: 24px; padding: 12px; }
  .card.small{ padding: 10px 12px; }

  .status{
  border-radius: 24px; gap: 6px; margin-bottom: 10px; }
  .pill{
  border-radius: 24px; padding: 5px 10px; }

  .choices{ margin-top: 10px; gap: 10px; }
  .choice{
  border-radius: 24px;
  
    min-height: 46px;
    font-size: 0.87rem;
    padding: 10px 14px;
  
}

  .divider{ margin: 10px 0 10px; }
  .footer{ gap: 10px; }
  .footer button{ min-height: 42px; }
}

/* If the user has very large system text sizes, allow internal scrolling within cards */
#mealCard, #bracketCard, #winnerCard{
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}




/* Prevent visible scrollbars while still allowing internal scroll if needed */
#mealCard::-webkit-scrollbar,
#bracketCard::-webkit-scrollbar,
#winnerCard::-webkit-scrollbar{
  width: 0;
  height: 0;
}


/* Powered by subtitle */



/* Force logo + powered-by to stack vertically */
.logo-stack{
  display: flex;
  flex-direction: column;
  align-items: center;
}


/* Force logo + subtitle to be vertically stacked in ALL cases */
.logoWrap{ 
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
}
.logo-stack{
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  width: 100% !important;
}


/* Powered-by footer (final, enforced) */
.powered-footer{
  width: 100%;
  margin: 12px auto 6px;
  font-size: 0.65rem !important;
  line-height: 1.2;
  color: #9aa4b2 !important;
  text-align: center !important;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 400;
  opacity: 0.9;
}


/* Diet filter UI */
.dietGrid{
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.dietBtn{
  border: none;
  border-radius: 24px;
  background: var(--bg);
  box-shadow: var(--shadow-light), var(--shadow-dark);
  min-height: 44px;
  padding: 10px 12px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

.dietBtn[aria-pressed="true"]{
  color: var(--accent);
  box-shadow: inset var(--shadow-light), inset var(--shadow-dark);
}

.dietCount{display:none;}

.dietNotice{
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 24px;
  background: var(--bg);
  box-shadow: inset var(--shadow-light), inset var(--shadow-dark);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.25;
  text-align: center;
}


@media (max-width: 360px){
  .dietGrid{ grid-template-columns: 1fr; }
}


@media (max-width: 480px){
  .dietGrid{ grid-template-columns: 1fr 1fr; }
}
@media (max-width: 360px){
  .dietGrid{ grid-template-columns: 1fr; }
}

/* Soften What's included card text */
.whatsIncluded, .whats-included, .included-title{
  font-weight: 400;
  color: #777;
  font-size: 0.85rem;
}
.included-desc, .whatsIncludedDesc, .included-steps{
  font-weight: 400;
  color: #888;
  font-size: 0.85rem;
}

.dietCard{margin-top:12px;}



/* What's included card: softer summary + steps */
.included summary{
  font-weight:400;
  color:#777;
  font-size:0.85rem;
}
.included #includedText{
  font-weight:400;
  color:#888;
  font-size:0.85rem;
}




/* Cuisine bracket: 2-column tiles with square thumbnails (like meal step).
   Actual tile pixel width is set in JS to match meal tile width exactly. */
.cuisineChoices{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  justify-items: center; /* center tiles within each column */
}

.choice.cuisineTile{
  /* width is set dynamically in JS */
  margin: 0 auto;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  text-align: center;
  padding: 10px 10px 12px;
  gap: 8px;
  min-height: unset;
}


/* ------------------------------
   Welcome Overlay (startup modal)
--------------------------------- */
.welcomeOverlay{
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0; /* avoid inset compatibility issues */
  background: rgba(255,255,255,0.80); /* fade to white */
  /* blur where supported */
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none; /* hidden until .show */
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.welcomeOverlay.show{
  display: flex;
}

.welcomeCard{
  background: #ffffff;
  border-radius: var(--radius);
  padding: 22px;
  max-width: 294px; /* ~30% narrower than 420px */
  width: calc(100% - 32px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.08);
  text-align: center;
}

.welcomeCard h2{
  margin: 6px 0 8px;
  font-size: 20px;
  letter-spacing: 0.2px;
}

.welcomeMsg{
  margin: 0 0 14px;
  opacity: 0.92;
  line-height: 1.35;
}

.welcomeToggle{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 0 0 12px;
  border-radius: 999px;
  background: rgba(11,15,20,0.04);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.welcomeToggle input{
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Blur/fade the app while welcome is open */
body.welcome-active .app{
  opacity: 0.92;
  pointer-events: none;
  user-select: none;
}


.welcomeContinue:active{
  transform: scale(0.98);
}

/* Welcome continue button: match choice (meal button) aesthetic, centered */
.welcomeContinue.choice{
  width: 100%;
  justify-content: center;
  text-align: center;
  min-height: 64px; /* medium like choices */
}


/* Prevent text/image selection + long-press highlight */
html, body, .app{
  -webkit-user-select: none; /* iOS Safari/Chrome */
  user-select: none;
  -webkit-tap-highlight-color: transparent; /* removes gray tap flash on iOS */
}

/* Prevent image dragging/selection in many browsers */
img, button, a{
  -webkit-user-drag: none;
  user-drag: none;
}

/* Optional stronger iOS long-press suppression */
*{
  -webkit-touch-callout: none;
}




/* iOS-style switch */
.ios-switch{
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
}
.ios-switch input{
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.ios-switch .slider{
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: background-color .2s ease;
  border-radius: 24px;
}
.ios-switch .slider:before{
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 2px;
  top: 2px;
  background-color: #fff;
  transition: transform .2s ease;
  border-radius: 50%;
}
.ios-switch input:checked + .slider{
  background-color: var(--accent);
}
.ios-switch input:checked + .slider:before{
  transform: translateX(18px);
}


.welcomeToggleText{cursor:pointer;}

/* Winner phase image */
.winnerImg{
  display:block;
  width:33%;
  max-width:180px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  margin: 12px auto 0 auto;
  border-radius: 12px;
}

/* Winner dish label button sizing tweaks */
#winnerCard .winnerName{
  width: 64%;
  margin-left: auto;
  margin-right: auto;
  padding-top: 10px;
  padding-bottom: 10px;
  font-size: 0.8em;
}

/* Winner dish label button sizing tweak (increase size, keep width) */
#winnerCard .winnerName{
  width: 64%;
  margin-left: auto;
  margin-right: auto;
  padding-top: 14px;
  padding-bottom: 14px;
  font-size: 1em;
}

/* Winner button with image inside */
#winnerCard .winnerName{
  width: 64%;
  margin: 16px auto 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* Winner image inside button */
#winnerCard .winnerImg{
  width: 100%;
  max-width: 140px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
}

/* Winner label text */
#winnerCard .winnerLabel{
  display: block;
  text-align: center;
}

/* Winner header spacing tightening */
#winnerCard{
  padding-top: 12px;
}

#winnerCard .winnerTitle{
  margin-top: 0;
  margin-bottom: 4px;
}

#winnerCard .winnerMeta{
  margin-top: 0;
  margin-bottom: 6px;
}

/* Winner button: narrower and slightly smaller */
#winnerCard .winnerName{
  width: 52%;
  padding-top: 12px;
  padding-bottom: 12px;
  font-size: 0.9em;
}

/* Winner subtitle (meal • cuisine): smaller + tighter */
#winnerCard .winnerMeta{
  font-size: 0.85em;
  margin-bottom: 4px;
}

/* Winner button: narrower + shorter to make space for Pick Again */
#winnerCard .winnerName{
  width: 44%;
  padding-top: 11px;
  padding-bottom: 11px;
  margin-top: 12px;
}

/* Image inside winner button: slightly smaller so the button doesn't grow tall */
#winnerCard .winnerImg{
  max-width: 120px;
}

/* Winner image: +5% scale */
#winnerCard .winnerImg{
  max-width: 126px; /* +5% from 120px */
}

/* Winner image larger, tighter padding (no button growth) */
#winnerCard .winnerName{
  padding-top: 9px;
  padding-bottom: 9px;
  gap: 6px;
}

#winnerCard .winnerImg{
  max-width: 138px; /* larger image */
}

/* Winner button asymmetric padding */
#winnerCard .winnerName{
  padding-top: 3px;
  padding-bottom: 7px;
}

/* Controls in final phases: 5% shorter height */
#winnerCard button,
#finalControls button,
.controls button{
  padding-top: 9px;
  padding-bottom: 9px;
}

/* Controls in final phases: ~10% shorter height */
#winnerCard button,
#finalControls button,
.controls button{
  padding-top: 8px;
  padding-bottom: 8px;
}

/* Final phase controls: scale to 80% */
#winnerCard .controls,
#finalControls,
#winnerCard .controls button,
#finalControls button{
  transform: scale(0.8);
  transform-origin: top center;
}

/* adaptive button label: keep single-line, allow JS to shrink font-size to fit */
button, .winnerLabel{
  white-space: nowrap;
}

/* Control buttons (Skip/Undo/Restart/Pick Again): real 80% sizing (override min-height) */
#skipBtn, #undoBtn, #resetBtn, #playAgainBtn{
  min-height: 0 !important;
  height: auto !important;
  padding: 8px 12px !important;
  font-size: 0.85em !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
}
