:root {
  color-scheme: dark;
  --bg: #050506;
  --bg-elevated: #15161a;
  --text: #f7f3ec;
  --muted: #b3aa9c;
  --line: rgba(255, 255, 255, 0.11);
  --accent: #ff6b2c;
  --accent-soft: #ffb07c;
  --asset-app-bg: none;
  --asset-hero: none;
  --asset-hot: none;
  --asset-recipe: none;
  --asset-butcher: none;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Heebo", "Assistant", system-ui, sans-serif;
  background:
    radial-gradient(circle at 10% 8%, rgba(255, 115, 40, 0.22), transparent 35%),
    radial-gradient(circle at 80% 20%, rgba(255, 69, 0, 0.15), transparent 30%),
    linear-gradient(180deg, #050506 0%, #0a0b0f 45%, #090909 100%),
    var(--asset-app-bg);
  background-size: cover, cover, cover, cover;
  background-position: center;
  color: var(--text);
}

.opening-splash {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 52% 46%, rgba(255, 132, 73, 0.24), transparent 42%),
    radial-gradient(circle at 40% 38%, rgba(255, 89, 0, 0.24), transparent 36%),
    repeating-radial-gradient(circle at center, rgba(255, 125, 66, 0.11) 0 1px, transparent 1px 11px),
    linear-gradient(180deg, #050506 0%, #0d0e12 100%),
    var(--asset-app-bg);
  background-size: cover;
  background-position: center;
  transition: opacity .35s ease, visibility .35s ease;
}

.opening-splash-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 46%, rgba(255, 110, 48, 0.24), transparent 42%),
    linear-gradient(180deg, rgba(8, 7, 6, 0.65), rgba(5, 5, 7, 0.86));
}

.opening-splash-content {
  position: relative;
  width: min(440px, 100%);
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 22px 16px 16px;
  border: 1px solid rgba(255, 173, 132, 0.24);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(18, 16, 14, 0.8), rgba(8, 8, 10, 0.78));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42), inset 0 0 24px rgba(255, 111, 52, 0.12);
}

.opening-logo {
  font-size: clamp(1.6rem, 8vw, 2.35rem);
  font-weight: 900;
  color: #ffd3b7;
  text-shadow: 0 0 8px rgba(255, 128, 64, .48), 0 0 28px rgba(255, 81, 0, .5);
  animation: splashPulse 2.1s ease-in-out infinite;
}

.opening-radar-loader {
  width: 120px;
  aspect-ratio: 1;
  border-radius: 999px;
  border: 1px solid rgba(255, 162, 120, .52);
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(255, 130, 69, 0.2) 0 16%, transparent 18%),
    repeating-radial-gradient(circle at center, rgba(255, 168, 124, 0.2) 0 2px, transparent 2px 18px),
    rgba(255,255,255,0.02);
  box-shadow: inset 0 0 20px rgba(255, 124, 68, 0.18), 0 0 30px rgba(255, 105, 50, 0.18);
}

.opening-radar-loader::before {
  content: "";
  position: absolute;
  inset: 0;
  background: conic-gradient(from 0deg, transparent 0deg 296deg, rgba(255, 142, 85, 0.88) 332deg, transparent 360deg);
  animation: radarSweep 2s linear infinite;
}

.opening-radar-loader span {
  position: absolute;
  width: 18px;
  aspect-ratio: 1;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 218, 191, .95), rgba(255, 116, 55, .1));
  left: 62%;
  top: 38%;
  filter: drop-shadow(0 0 10px rgba(255, 110, 48, 0.78));
  animation: emberPulse 1.6s ease-in-out infinite;
}

.opening-message {
  margin: 2px 0 0;
  min-height: 1.5em;
  color: #ffe4d2;
  font-weight: 700;
  font-size: .98rem;
  text-align: center;
  transition: opacity .26s ease, transform .26s ease;
}

.opening-message.is-swapping {
  opacity: .25;
  transform: translateY(3px);
}

.opening-steps {
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  width: 100%;
  display: grid;
  gap: 7px;
}

.opening-step {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: .86rem;
  color: rgba(255, 238, 224, 0.72);
  background: rgba(255,255,255,0.02);
  transition: border-color .24s ease, color .24s ease, background-color .24s ease, transform .24s ease;
}

.opening-step.active {
  color: #ffe0ca;
  border-color: rgba(255, 143, 82, 0.56);
  background: linear-gradient(90deg, rgba(255, 117, 53, 0.22), rgba(255, 117, 53, 0.05));
  transform: translateX(-2px);
}
html[dir="ltr"] .opening-step.active { transform: translateX(2px); }

.opening-progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  overflow: hidden;
}

.opening-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #ffc39a 0%, #ff8a45 40%, #ff5a1f 100%);
  box-shadow: 0 0 16px rgba(255, 108, 48, 0.44);
  transition: width .35s cubic-bezier(.2, .75, .2, 1);
}

.opening-splash.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.app-shell {
  min-height: 100vh;
  max-width: 520px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 14px calc(24px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
}

.app-header {
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(7, 7, 9, 0.58), rgba(10, 8, 7, 0.88)),
    radial-gradient(circle at 78% 20%, rgba(255, 111, 43, 0.35), transparent 45%),
    var(--asset-hero);
  background-size: cover;
  background-position: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), inset 0 0 80px rgba(0,0,0,0.42);
}
.app-header.landing-minimal {
  padding-top: 12px;
  padding-bottom: 12px;
}
.brand { margin: 0; color: var(--accent-soft); font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
#screenTitle { margin: 8px 0 0; font-size: clamp(1.55rem, 5.2vw, 2.4rem); line-height: 1.05; font-weight: 900; }
.hero-subtitle { margin: 6px 0 0; color: var(--muted); font-size: .92rem; }
.app-header.landing-minimal #screenTitle,
.app-header.landing-minimal .hero-subtitle {
  display: none;
}

.progress-wrap { margin-top: 10px; display: grid; gap: 4px; }
.progress-text { font-size: .78rem; color: #f5be93; }
.progress-track { height: 6px; border-radius: 999px; background: rgba(255,255,255,.11); overflow: hidden; }
.progress-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ff9b61, #ff5a1f); transition: width .25s ease; }

.screen-content {
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 12px;
  background:
    linear-gradient(160deg, rgba(255, 109, 50, 0.08), transparent 40%),
    linear-gradient(180deg, rgba(21,22,26,.86), rgba(10,10,12,.94));
  display: grid;
  gap: 10px;
  align-content: start;
  overflow-y: auto;
}

.card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.visual-card {
  position: relative;
  min-height: 110px;
  background:
    linear-gradient(180deg, rgba(0,0,0,.2), rgba(0,0,0,.72)),
    radial-gradient(circle at 80% 20%, rgba(255, 123, 62, 0.35), transparent 45%),
    var(--asset-hot);
  background-size: cover;
  background-position: center;
}

.visual-map {
  min-height: 145px;
  background:
    radial-gradient(circle at 18% 68%, rgba(255,111,52,.34) 0 6px, transparent 8px),
    radial-gradient(circle at 58% 32%, rgba(255,111,52,.32) 0 5px, transparent 7px),
    radial-gradient(circle at 80% 52%, rgba(255,111,52,.32) 0 5px, transparent 7px),
    repeating-linear-gradient(25deg, rgba(255,255,255,.06), rgba(255,255,255,.06) 1px, transparent 1px, transparent 13px),
    linear-gradient(180deg, rgba(14,18,22,.18), rgba(8,8,8,.72)),
    var(--asset-butcher);
  background-size: cover;
  background-position: center;
  filter: brightness(1.08) contrast(1.06);
}

.recipe-hero {
  min-height: 180px;
  display: grid;
  align-content: end;
  gap: 6px;
  background:
    linear-gradient(180deg, rgba(0,0,0,.2), rgba(0,0,0,.84)),
    radial-gradient(circle at 85% 12%, rgba(255, 124, 66, 0.34), transparent 45%),
    var(--recipe-image, var(--asset-recipe));
  background-size: cover;
  background-position: center;
}

.badges-row { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  padding: 6px 10px;
  border: 1px solid rgba(255, 162, 120, 0.38);
  border-radius: 999px;
  font-size: .78rem;
  background: rgba(255, 255, 255, .04);
}
.badge strong { color: var(--accent-soft); }
.badge-emphasis { background: rgba(255, 107, 44, .2); border-color: rgba(255, 107, 44, .66); }

.meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.meta-item { border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: rgba(255,255,255,.02); }
.meta-item strong { display: block; color: var(--accent-soft); font-size: .76rem; }

.btn {
  width: 100%;
  border-radius: 16px;
  border: 1px solid transparent;
  padding: 13px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .18s ease, filter .18s ease;
}
.btn-primary {
  color: white;
  background: linear-gradient(135deg, #ff9b61 0%, #ff6b2c 50%, #df3f00 100%);
  box-shadow: 0 0 0 1px rgba(255,121,56,.34), 0 12px 24px rgba(255,92,26,.36);
  animation: ctaGlow 2.6s ease-in-out infinite;
}
.btn-ghost { background: rgba(255,255,255,.03); color: var(--text); border-color: var(--line); }
.btn-choice {
  font-weight: 700;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border-color: var(--line);
  color: var(--text);
  text-align: start;
}
.btn-choice.active { border-color: rgba(255,117,49,.65); box-shadow: inset 0 0 0 1px rgba(255,117,49,.45); }
.btn-choice-hot {
  background: linear-gradient(135deg, #ffb177 0%, #ff7a33 45%, #cc3300 100%);
  border-color: rgba(255, 137, 78, 0.7);
  box-shadow: 0 12px 24px rgba(255, 89, 31, 0.35);
}
.btn-choice-know {
  background: linear-gradient(180deg, rgba(255, 141, 84, 0.22), rgba(255, 141, 84, 0.08));
  border-color: rgba(255, 150, 96, 0.32);
}
.btn-choice-saved {
  padding-block: 11px;
  font-size: .95rem;
  background: rgba(255,255,255,.025);
  border-color: rgba(255,255,255,.14);
  color: #d7d0c4;
}
.btn:active { transform: translateY(1px) scale(.99); filter: brightness(.98); }
.btn:hover { transform: translateY(-1px); }
.card:hover { transform: translateY(-1px); border-color: rgba(255, 141, 89, .3); }
.butcher-card.featured { border-color: rgba(255, 139, 81, .55); box-shadow: inset 0 0 0 1px rgba(255, 139, 81, .2); }
.butcher-rating { margin: 0; word-break: break-word; flex: 1; min-width: 155px; }
.butcher-footer {
  margin-top: 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.butcher-footer .btn {
  width: auto;
  min-width: 132px;
  padding: 10px 16px;
  margin: 0;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.screen-transition { animation: stepShift .24s ease; }

.app-nav { display: grid; gap: 10px; grid-template-columns: 1fr 1.2fr; }
.small { color: var(--muted); font-size: .88rem; margin: 0; }
.list { margin: 8px 0 0; padding-inline: 18px; display: grid; gap: 7px; }
.inline-actions { display: grid; gap: 8px; }
.group-title { margin: 0 0 8px; color: var(--accent-soft); font-size: .87rem; }
.check-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed rgba(255,255,255,.09);
}
.check-item span { text-align: left; }
.check-item input { margin-top: 2px; }
.saved-recipe-card {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 10px;
  align-items: start;
}
.saved-thumb {
  width: 74px;
  height: 74px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .14);
}
.saved-recipe-content h3 {
  margin-top: 0;
  margin-bottom: 8px;
}
.saved-recipe-actions {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}
.last-recipe-prompt p {
  margin: 0 0 8px;
  font-weight: 700;
}
.legal-menu {
  opacity: .86;
  display: grid;
  gap: 8px;
  margin-top: 0;
  padding: 9px;
  border-radius: 14px;
  border-color: rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  transform: scale(.985);
  transform-origin: center top;
}
.legal-menu h3 {
  margin: 0 0 2px;
  color: #a69b8d;
  font-size: .82rem;
  font-weight: 700;
}
.footer-separator {
  height: 1px;
  margin: 18px 18px 8px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.18), transparent);
}
.footer-note {
  margin-top: 4px;
  opacity: 0.72;
  font-size: .72rem;
}
.sub-recipe-block + .sub-recipe-block {
  border-top: 1px dashed rgba(255, 255, 255, .15);
  margin-top: 10px;
  padding-top: 10px;
}
.sub-recipe-block h4 {
  margin: 0 0 8px;
  color: #ffd5bb;
  font-size: 1rem;
  font-weight: 800;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #f0ddd0;
  font-weight: 800;
}

.cook-mode-header {
  margin-bottom: 6px;
  border-color: rgba(255, 152, 102, .34);
  background: linear-gradient(180deg, rgba(255, 120, 58, .12), rgba(255, 120, 58, .02));
}
.cook-mode-title {
  margin: 0 0 8px;
  font-size: 1.15rem;
  letter-spacing: .01em;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; opacity: .95; }
.chip {
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.02);
  font-size: .74rem;
}
.chip:nth-child(3n) {
  border-color: rgba(255, 140, 84, 0.35);
  color: #f2d7bf;
}
.hero-card h2 {
  font-size: clamp(1.45rem, 5.6vw, 2.25rem);
  margin: 0;
  text-shadow: 0 6px 24px rgba(0,0,0,.58);
}
.hero-card .small {
  color: #f3dbca;
}
.field { display: grid; gap: 5px; }
label { color: var(--muted); font-size: .88rem; }
select, input {
  width: 100%;
  background: #111317;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px;
}
.cut-helper-text,
.method-helper-text {
  margin-top: 3px;
  font-size: .8rem;
  color: #cfb9a2;
}
.servings-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.servings-btn {
  width: 42px;
  min-width: 42px;
  padding: 8px;
  border-radius: 10px;
  font-size: 1.1rem;
}
.recipe-servings-inline {
  justify-content: center;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
}
.servings-label {
  min-width: 100%;
  text-align: center;
}

.branded-loader {
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 10px;
  min-height: 170px;
  align-content: center;
}
.loading-radar {
  width: 96px;
  animation: radarBreathe 1.8s ease-in-out infinite;
}
.loading-radar-small {
  width: 84px;
}
.loading-message {
  min-height: 1.6em;
  transition: opacity .2s ease, transform .2s ease;
}
.loading-message.is-swapping {
  opacity: .28;
  transform: translateY(2px);
}
.loading-dots span {
  display: inline-block;
  animation: loadingDots 1.1s infinite ease-in-out;
}
.loading-dots span:nth-child(2) { animation-delay: .15s; }
.loading-dots span:nth-child(3) { animation-delay: .3s; }
.loading-progress-pulse {
  width: min(240px, 84%);
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .09);
  overflow: hidden;
  border: 1px solid rgba(255, 170, 132, .22);
}
.loading-progress-pulse span {
  display: block;
  width: 48%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 179, 141, .4), rgba(255, 107, 44, .95));
  box-shadow: 0 0 14px rgba(255, 107, 44, .45);
  animation: loadingPulseSlide 1.9s cubic-bezier(.4,0,.2,1) infinite;
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 173, 132, 0.32);
  background: rgba(8, 8, 10, 0.95);
  color: #ffe3d2;
  font-weight: 700;
  z-index: 70;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .22s ease;
}
.app-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.hidden { display: none !important; }
.fade-in { animation: fadeIn .28s ease; }

.legal-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
}
.legal-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}
.legal-sheet {
  position: absolute;
  inset-inline: 10px;
  bottom: 10px;
  max-height: min(78vh, 620px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(16, 16, 19, 0.98), rgba(8, 8, 10, 0.98));
}
.legal-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.legal-sheet-header h3 {
  margin: 0;
  color: #ffd5bb;
}
.legal-close {
  width: auto;
  min-width: 42px;
  padding: 8px 12px;
}
.legal-sheet-body {
  display: grid;
  gap: 10px;
}
.legal-sheet-body p {
  margin: 0;
  line-height: 1.5;
}

html[dir="rtl"] .group-title,
html[dir="rtl"] .check-item {
  text-align: right;
}
html[dir="rtl"] .check-item {
  grid-template-columns: auto 1fr;
  direction: ltr;
}
html[dir="rtl"] .check-item span {
  direction: rtl;
  text-align: right;
}
html[dir="rtl"] .butcher-footer {
  direction: rtl;
}
html[dir="rtl"] .butcher-rating {
  direction: rtl;
  text-align: right;
}

@keyframes fadeIn { from { opacity: .15; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes splashPulse {
  0%, 100% { opacity: .9; transform: scale(.99); filter: blur(.1px); }
  50% { opacity: 1; transform: scale(1.02); filter: blur(0); }
}
@keyframes radarSweep {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes emberPulse {
  0%, 100% { opacity: .7; transform: scale(.78); }
  50% { opacity: 1; transform: scale(1.03); }
}
@keyframes stepShift {
  from { opacity: .75; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes ctaGlow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255,121,56,.34), 0 12px 24px rgba(255,92,26,.26); }
  50% { box-shadow: 0 0 0 1px rgba(255,121,56,.5), 0 14px 30px rgba(255,92,26,.42); }
}
@keyframes loadingDots {
  0%, 80%, 100% { opacity: .25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}
@keyframes radarBreathe {
  0%,100% { transform: scale(.98); filter: drop-shadow(0 0 6px rgba(255,120,60,.22)); }
  50% { transform: scale(1.03); filter: drop-shadow(0 0 14px rgba(255,120,60,.45)); }
}

@keyframes loadingPulseSlide {
  0% { transform: translateX(-110%); opacity: .5; }
  35% { opacity: 1; }
  100% { transform: translateX(210%); opacity: .5; }
}

@media (min-width: 700px) {
  .app-shell { margin-top: 16px; border: 1px solid var(--line); border-radius: 24px; overflow: hidden; }
}
