:root {
  color-scheme: light;
  --ink: #292522;
  --muted: #746d67;
  --cream: #fff8e9;
  --paper: #fffdf7;
  --tomato: #ff6652;
  --tomato-dark: #dc4939;
  --yellow: #ffd86b;
  --line: #292522;
  --shadow: 5px 6px 0 var(--line);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { touch-action: manipulation; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 216, 107, .55) 0 42px, transparent 43px),
    radial-gradient(circle at 92% 83%, rgba(255, 102, 82, .16) 0 70px, transparent 71px),
    var(--cream);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

button, input { font: inherit; }

.app-shell {
  width: calc(100% - 28px);
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 0 24px;
  padding-top: calc(28px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px)));
  padding-bottom: calc(24px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
}

.entry-card {
  position: relative;
  overflow: hidden;
  padding: 28px 20px;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 28px;
  box-shadow: 8px 9px 0 var(--line);
  animation: reveal .28s ease;
}
.cover-screen { min-height: calc(100vh - 120px); min-height: calc(100dvh - 120px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.cover-screen::before, .cover-screen::after { content: "✦"; position: absolute; color: var(--tomato); font-size: 30px; }
.cover-screen::before { top: 28px; left: 26px; transform: rotate(-12deg); }
.cover-screen::after { right: 28px; bottom: 112px; color: #efb429; transform: rotate(18deg); }
.cover-badge { padding: 6px 12px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--yellow); font-size: .75rem; font-weight: 900; letter-spacing: .08em; transform: rotate(-2deg); }
.cover-art { width: min(210px, 58vw); margin: 28px auto 18px; filter: drop-shadow(0 10px 0 rgba(41,37,34,.12)); }
.cover-eyebrow { margin: 0 0 8px; color: var(--tomato-dark); font-size: .82rem; font-weight: 900; letter-spacing: .1em; }
.cover-screen h1 { margin: 0; font-size: 2.5rem; font-size: clamp(2.5rem, 13vw, 4rem); letter-spacing: -.08em; }
.cover-copy { max-width: 330px; margin: 15px auto 26px; color: var(--muted); font-size: .95rem; line-height: 1.65; }
.cover-copy span { display: block; white-space: nowrap; }
.cover-start { width: min(100%, 330px); height: 58px; border: 2px solid var(--line); border-radius: 18px; background: var(--tomato); color: #fff; box-shadow: var(--shadow); font-size: 1.05rem; font-weight: 900; cursor: pointer; }
.cover-start span { margin-left: 8px; font-size: 1.25rem; }

@media (max-height: 760px) {
  .app-shell { padding-top: 14px; padding-bottom: 14px; }
  .cover-screen { min-height: calc(100vh - 72px); min-height: calc(100dvh - 72px); padding-top: 20px; padding-bottom: 20px; }
  .cover-art { width: 170px; margin-top: 16px; margin-bottom: 12px; }
  .cover-copy { margin-top: 10px; margin-bottom: 16px; }
  .cover-start { height: 52px; }
}
.section-hub { padding-bottom: 26px; }
.entry-back, .picker-back { padding: 5px 2px; border: 0; background: transparent; color: var(--muted); font-size: .78rem; font-weight: 800; cursor: pointer; }
.floating-picker-back {
  position: fixed;
  z-index: 30;
  top: 14px;
  top: calc(14px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px)));
  left: 14px;
  min-height: 38px;
  padding: 7px 12px 7px 10px;
  border: 1px solid #ded5c6;
  border-radius: 999px;
  background: rgba(255, 248, 233, .96);
  color: #6f6258;
  box-shadow: 0 4px 12px rgba(41, 37, 34, .12);
  font-size: .72rem;
  font-weight: 800;
  cursor: pointer;
}
.floating-picker-back span { margin-right: 3px; color: var(--tomato-dark); font-size: 1.05rem; font-weight: 900; line-height: 0; }
.floating-picker-back:active { transform: translateY(1px); background: #fff1d2; box-shadow: 0 2px 6px rgba(41, 37, 34, .1); }
.hub-heading { margin: 22px 0 24px; }
.hub-heading p { margin: 0 0 5px; color: var(--tomato-dark); font-size: .78rem; font-weight: 900; }
.hub-heading h1 { margin: 0 0 8px; font-size: 2rem; }
.hub-heading span { color: var(--muted); font-size: .8rem; line-height: 1.5; }
.module-card { display: flex; align-items: center; width: 100%; min-height: 82px; padding: 14px; border: 1.5px solid #ded5c6; border-radius: 18px; background: #fff; color: var(--ink); text-align: left; cursor: pointer; }
.module-card-featured { border: 2px solid var(--line); background: #fff1bd; box-shadow: 5px 6px 0 var(--line); }
.module-icon { display: grid; flex: 0 0 46px; width: 46px; height: 46px; margin-right: 12px; place-items: center; border-radius: 14px; background: #fff; font-size: 1.45rem; }
.module-card > span:nth-child(2) { display: flex; flex: 1; min-width: 0; flex-direction: column; }
.module-card b { font-size: .95rem; }
.module-card small { margin-top: 4px; color: var(--muted); font-size: .7rem; font-style: normal; line-height: 1.35; }
.module-card em { color: #8c5945; font-size: .72rem; font-style: normal; font-weight: 900; white-space: nowrap; }
.module-card i { font-style: normal; }
.hub-section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 11px; }
.hub-section-title b { font-size: .92rem; }
.hub-section-title span { color: var(--muted); font-size: .66rem; }
.module-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.module-grid .module-card { min-height: 92px; padding: 12px; }
.module-grid .module-icon { flex-basis: 40px; width: 40px; height: 40px; margin-right: 9px; }
.module-grid .module-card:first-child { grid-column: 1 / -1; }
.module-grid .module-card:last-child:nth-child(even) { grid-column: 1 / -1; }
.future-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.future-grid button { min-height: 90px; padding: 10px 5px; border: 1.5px dashed #d7ccbb; border-radius: 16px; background: #f7f3ea; color: #857c72; }
.future-grid button:only-child { grid-column: 1 / -1; }
.future-grid button span, .future-grid button b, .future-grid button small { display: block; }
.future-grid button span { margin-bottom: 5px; font-size: 1.25rem; filter: grayscale(.35); }
.future-grid button b { font-size: .76rem; }
.future-grid button small { margin-top: 3px; font-size: .6rem; }
.picker-back { position: relative; z-index: 2; margin-bottom: 5px; }
.current-category { display: inline-block; margin-top: 9px; padding: 4px 9px; border-radius: 999px; background: #fff0c4; color: #8b552d; font-size: .68rem; font-weight: 900; }

.picker-card {
  position: relative;
  overflow: hidden;
  padding: 28px 20px 22px;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 28px;
  box-shadow: 8px 9px 0 var(--line);
}

.picker-card::after {
  content: "✦";
  position: absolute;
  top: 18px;
  right: 20px;
  color: var(--tomato);
  font-size: 24px;
  transform: rotate(12deg);
}

.brand { margin-bottom: 18px; text-align: center; }

.brand-badge {
  display: inline-block;
  padding: 5px 10px;
  color: var(--ink);
  background: var(--yellow);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  transform: rotate(-2deg);
}

h1 {
  margin: 12px 0 5px;
  font-size: 2rem;
  line-height: 1.1;
  letter-spacing: -.06em;
}

.brand p { margin: 0; color: var(--muted); font-size: 1rem; }

.brand-art {
  display: block;
  width: 112px;
  height: 112px;
  margin: 8px auto -2px;
  object-fit: contain;
  filter: drop-shadow(3px 4px 0 rgba(41, 37, 34, .16));
}

.filters { display: grid; grid-gap: 20px; }

fieldset { margin: 0; padding: 0; border: 0; }

legend {
  margin-bottom: 9px;
  padding: 0;
  font-size: .95rem;
  font-weight: 800;
}

legend span { color: var(--tomato-dark); font-size: .78rem; margin-right: 5px; }

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-gap: 7px;
}

.segmented-control label { cursor: pointer; }
.segmented-control input { position: absolute; opacity: 0; pointer-events: none; }

.segmented-control label span {
  display: grid;
  min-height: 43px;
  place-items: center;
  padding: 8px 5px;
  color: var(--muted);
  background: #fff;
  border: 1.5px solid #ded7ca;
  border-radius: 12px;
  font-size: .9rem;
  font-weight: 700;
  text-align: center;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}

.segmented-control input:checked + span {
  color: var(--ink);
  background: var(--yellow);
  border-color: var(--line);
  box-shadow: 2px 2px 0 var(--line);
  transform: translate(-1px, -1px);
}

.segmented-control input:focus + span { outline: 3px solid rgba(255, 102, 82, .35); outline-offset: 2px; }
.segmented-control input:focus-visible + span { outline: 3px solid rgba(255, 102, 82, .35); outline-offset: 2px; }

.repeat-setting { display: block; }
.repeat-setting select {
  width: 100%;
  min-height: 45px;
  padding: 9px 38px 9px 12px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid #ded7ca;
  border-radius: 12px;
  font-size: .9rem;
  font-weight: 800;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #6f6258 50%), linear-gradient(135deg, #6f6258 50%, transparent 50%);
  background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.repeat-setting select:focus { outline: 3px solid rgba(255, 102, 82, .25); outline-offset: 2px; border-color: var(--line); }
.repeat-setting > span { display: block; margin-top: 6px; color: var(--muted); font-size: .72rem; }

.ingredient-filter-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.ingredient-filter-title { margin: 0; font-size: .95rem; font-weight: 800; }
.ingredient-filter-title span { margin-right: 5px; color: var(--tomato-dark); font-size: .78rem; }
.ingredient-filter-heading button { padding: 5px 9px; color: var(--muted); background: #fff; border: 1px solid #d8d0c2; border-radius: 8px; font-size: .7rem; cursor: pointer; }
.ingredient-options { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 7px; }
.ingredient-options label { cursor: pointer; }
.ingredient-options input { position: absolute; opacity: 0; pointer-events: none; }
.ingredient-options label span, .ingredient-parent {
  display: grid;
  min-height: 39px;
  place-items: center;
  padding: 6px 4px;
  color: #625a53;
  background: #fff;
  border: 1.5px solid #ded7ca;
  border-radius: 11px;
  font-size: .78rem;
  font-weight: 800;
  text-align: center;
}
.ingredient-parent { position: relative; width: 100%; font-family: inherit; cursor: pointer; }
.ingredient-parent b { position: absolute; right: 8px; font-size: 1rem; transition: transform .18s ease; }
.ingredient-parent[aria-expanded="true"] b { transform: rotate(90deg); }
.ingredient-parent.is-selected, .ingredient-parent[aria-expanded="true"] { color: var(--ink); background: #ffdc78; border-color: var(--line); box-shadow: 2px 2px 0 var(--line); transform: translate(-1px, -1px); }
.ingredient-options input:checked + span { color: var(--ink); background: #ffdc78; border-color: var(--line); box-shadow: 2px 2px 0 var(--line); transform: translate(-1px, -1px); }
.ingredient-options input:focus + span { outline: 3px solid rgba(255, 102, 82, .25); outline-offset: 2px; }
.ingredient-parent:focus, .ingredient-parent:focus-visible { outline: 3px solid rgba(255, 102, 82, .25); outline-offset: 2px; }
.meat-detail { grid-column: 1 / -1; box-sizing: border-box; width: 100%; margin: 2px 0 3px; padding: 10px; background: #fff8df; border: 1.5px solid #e1d4af; border-radius: 12px; animation: reveal .2s ease; }
.meat-detail p { margin: 0 0 8px; color: #655c50; font-size: .75rem; font-weight: 800; }
.meat-detail-options { display: flex; flex-wrap: wrap; margin-right: -7px; margin-bottom: -7px; }
.meat-detail-options label { cursor: pointer; }
.meat-detail-options label { margin-right: 7px; margin-bottom: 7px; }
.meat-detail-options input { position: absolute; opacity: 0; pointer-events: none; }
.meat-detail-options span { display: block; padding: 7px 10px; color: #625a53; background: #fff; border: 1.5px solid #ded7ca; border-radius: 999px; font-size: .75rem; font-weight: 800; }
.meat-detail-options input:checked + span { color: #fff; background: #d94a3d; border-color: #a62f27; }
.meat-detail-options input:focus + span { outline: 3px solid rgba(255, 102, 82, .25); outline-offset: 2px; }
.mood-options { display: grid; grid-template-columns: repeat(2, 1fr); grid-gap: 8px; }
.mood-options label { cursor: pointer; }
.mood-options input { position: absolute; opacity: 0; pointer-events: none; }
.mood-options span { display: grid; min-height: 43px; padding: 7px 5px; place-items: center; color: #625a53; background: #fff; border: 1.5px solid #ded7ca; border-radius: 12px; font-size: .8rem; font-weight: 800; text-align: center; }
.mood-options input:checked + span { color: var(--ink); background: #ffdc78; border-color: var(--line); box-shadow: 2px 2px 0 var(--line); transform: translate(-1px, -1px); }
.mood-options input:focus + span, .mood-options input:focus-visible + span { outline: 3px solid rgba(255, 102, 82, .25); outline-offset: 2px; }
.ingredient-filter-note { margin: 7px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.45; }

.draw-button, .accept-button, .retry-button, .exclude-button {
  min-height: 50px;
  border: 2px solid var(--line);
  border-radius: 15px;
  font-weight: 900;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}

.draw-button {
  width: 100%;
  margin-top: 26px;
  color: #fff;
  background: var(--tomato);
  box-shadow: var(--shadow);
  font-size: 1.12rem;
}

.draw-button:hover { background: var(--tomato-dark); }
.accept-button:hover { background: #287a55; }
.exclude-button:hover { background: #c43d32; }
.draw-button:active, .accept-button:active, .retry-button:active, .exclude-button:active { transform: translate(4px, 5px); box-shadow: 1px 1px 0 var(--line); }
.draw-button:focus, .accept-button:focus, .retry-button:focus, .exclude-button:focus { outline: 3px solid rgba(255, 102, 82, .35); outline-offset: 3px; }
.draw-button:focus-visible, .accept-button:focus-visible, .retry-button:focus-visible, .exclude-button:focus-visible { outline: 3px solid rgba(255, 102, 82, .35); outline-offset: 3px; }

.result {
  margin-top: 28px;
  padding: 24px 16px 16px;
  text-align: center;
  background: #fff4cf;
  border: 2px solid var(--line);
  border-radius: 22px;
  animation: reveal .42s cubic-bezier(.2, .8, .2, 1);
}

.result-label {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--tomato-dark);
  font-size: .8rem;
  font-weight: 900;
  letter-spacing: .12em;
}

.dish-visual {
  display: grid;
  width: 78px;
  height: 78px;
  margin: 0 auto 10px;
  place-items: center;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 50%;
  box-shadow: 3px 3px 0 var(--line);
  font-size: 2.5rem;
}

.result h2 { margin: 6px 0 7px; font-size: 1.75rem; letter-spacing: -.04em; }

.dish-calories {
  display: inline-block;
  margin: 0 0 13px;
  padding: 5px 10px;
  color: #7a342b;
  background: #ffe2dc;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 900;
}
.fitness-macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 14px; padding: 12px; color: #31533a; background: #edf8ee; border: 1px solid #b9d5bd; border-radius: 14px; text-align: center; }
.fitness-macros > div { padding: 8px 3px; background: rgba(255,255,255,.78); border-radius: 10px; }
.fitness-macros span, .fitness-macros small { display: block; color: #667b69; font-size: .66rem; }
.fitness-macros strong { display: inline-block; margin: 3px 2px 1px 0; color: #255f3d; font-size: 1.15rem; }
.fitness-macros small { display: inline; }
.fitness-macros p { grid-column: 1 / -1; margin: 1px 2px 0; color: #718074; font-size: .63rem; line-height: 1.45; text-align: left; }
.serving-picker { margin: 18px 0 4px; padding: 14px; border: 1px solid #dfd4bd; border-radius: 14px; background: rgba(255,255,255,.72); text-align: left; }
.serving-picker > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.serving-picker strong { font-size: .9rem; }
.serving-picker span { color: var(--muted); font-size: .68rem; }
.serving-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 10px; }
.serving-options button { padding: 8px 3px; border: 1px solid #d8cdb8; border-radius: 10px; background: #fff; color: #514a44; font-size: .78rem; font-weight: 800; }
.serving-options button.is-selected { color: #24211f; background: #ffd86f; border-color: #292522; box-shadow: 0 3px 0 #292522; }

.dish-tags { display: flex; flex-wrap: wrap; justify-content: center; }

.pending-choice {
  margin: 0 0 22px;
  padding: 16px;
  color: var(--ink);
  background: #fff4c7;
  border: 1.5px solid var(--line);
  border-radius: 17px;
  box-shadow: 4px 5px 0 var(--line);
  text-align: left;
  animation: reveal .35s ease;
}

.pending-choice-kicker {
  margin-bottom: 10px;
  color: var(--tomato-dark);
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .08em;
}

.pending-choice-main { display: flex; align-items: center; }
.pending-choice-emoji {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  margin-right: 12px;
  place-items: center;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  font-size: 1.7rem;
}
.pending-choice-main h2 { margin: 0 0 3px; font-size: 1.3rem; }
.pending-choice-main p { margin: 0; color: var(--muted); font-size: .8rem; }
.pending-choice-actions { display: grid; grid-template-columns: 1fr 1fr; grid-gap: 8px; margin-top: 13px; }
.pending-choice-actions button { padding: 10px 8px; background: #fff; border-radius: 10px; font-size: .78rem; }
.pending-choice-actions .pending-start { grid-column: 1 / -1; color: #fff; background: var(--tomato); }

.eaten-history {
  margin: 0 0 22px;
  padding: 15px;
  color: var(--ink);
  background: #f1fbf4;
  border: 1.5px solid #577961;
  border-radius: 17px;
  text-align: left;
}
.eaten-history-heading { display: flex; align-items: center; justify-content: space-between; }
.eaten-history-heading span { color: #4e765a; font-size: .68rem; font-weight: 900; letter-spacing: .08em; }
.eaten-history-heading h2 { margin: 2px 0 0; font-size: 1.05rem; }
.eaten-history-heading button { padding: 6px 9px; color: #68736b; background: transparent; border-color: #9ab7a2; font-size: .7rem; }
.eaten-history-list { margin-top: 11px; }
.eaten-history-list > div { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-top: 1px solid #d9e9dd; }
.eaten-history-list strong { font-size: .84rem; }
.eaten-history-list span { color: #758079; font-size: .74rem; }
.eaten-history > p { margin: 7px 0 0; color: #78827a; font-size: .7rem; }

.dish-tags span {
  margin: 0 3px 7px;
  padding: 5px 9px;
  background: #fff;
  border: 1px solid #d7cdae;
  border-radius: 999px;
  color: #5d5548;
  font-size: .8rem;
  font-weight: 700;
}

.needed-ingredients {
  margin-top: 13px;
  padding: 13px;
  background: #fffdf8;
  border: 1.5px solid #d7cdae;
  border-radius: 14px;
  text-align: left;
}
.ingredient-match { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px dashed #ded2b2; }
.ingredient-match-copy { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 7px; }
.ingredient-match-copy strong { color: #287653; font-size: .88rem; }
.ingredient-match-copy span { margin-left: 8px; color: var(--muted); font-size: .68rem; font-weight: 700; text-align: right; }
.ingredient-match-track { height: 8px; overflow: hidden; background: #eee7d5; border-radius: 999px; }
.ingredient-match-track span { display: block; width: 0; height: 100%; background: #43a777; border-radius: inherit; transition: width .25s ease; }
.needed-ingredients-heading { display: flex; align-items: center; margin-bottom: 9px; }
.needed-ingredients-heading > span {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  margin-right: 9px;
  place-items: center;
  background: #ffdc78;
  border-radius: 10px;
  font-size: 1rem;
}
.needed-ingredients-heading p { margin: 0 0 1px; color: var(--muted); font-size: .68rem; }
.needed-ingredients-heading h3 { margin: 0; font-size: .95rem; }
.needed-ingredients-list { display: flex; flex-wrap: wrap; }
.needed-ingredients-list span { margin: 0 6px 6px 0; padding: 6px 8px; color: #6e3e32; background: #fff0e9; border: 1px solid #e4b4a6; border-radius: 9px; font-size: .76rem; font-weight: 800; }
.needed-ingredients-note { margin: 3px 0 0; color: #8a8178; font-size: .68rem; line-height: 1.45; }

.verdict {
  margin: 18px 0 0;
  padding: 12px;
  color: var(--tomato-dark);
  background: rgba(255, 255, 255, .7);
  border-radius: 12px;
  font-weight: 900;
  animation: pop .3s ease;
}

.result-actions { display: grid; grid-template-columns: 1fr; grid-gap: 9px; margin-top: 20px; }
.accept-button { color: #fff; background: #2f8f63; border-color: #245f45; box-shadow: 3px 4px 0 #245f45; }
.retry-button { color: var(--ink); background: #fff; box-shadow: 3px 4px 0 var(--line); }
.retry-button:hover { background: #fff9ec; }
.exclude-button { color: #fff; background: #d94b3d; border-color: #8a2d25; box-shadow: 3px 4px 0 #8a2d25; }

.exclusion-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 10px 11px;
  color: #70493f;
  background: #fff8f0;
  border: 1px dashed #c99583;
  border-radius: 12px;
  font-size: .76rem;
  font-weight: 800;
}
.exclusion-status > div { display: flex; margin-left: 8px; }
.exclusion-status button { margin-left: 6px; padding: 5px 7px; color: #765146; background: #fff; border-color: #d8aa9b; border-radius: 7px; font-size: .68rem; }

.exclusion-feedback {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid;
  border-radius: 10px;
  font-size: .76rem;
  font-weight: 800;
  line-height: 1.45;
  animation: reveal .22s ease;
}
.exclusion-feedback.is-excluded { color: #8a2d25; background: #fff0ed; border-color: #d98f84; }
.exclusion-feedback.is-restored { color: #276b49; background: #eef9f1; border-color: #91b99d; }

.recipe {
  margin-top: 22px;
  padding: 18px;
  color: var(--ink);
  background: #fff;
  border: 1.5px dashed var(--line);
  border-radius: 17px;
  text-align: left;
  animation: reveal .35s ease;
}

.recipe-heading {
  display: flex;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid #e8dfc9;
}

.recipe-heading > span {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  margin-right: 11px;
  place-items: center;
  background: var(--yellow);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font-size: 1.35rem;
  transform: rotate(-3deg);
}

.recipe-heading p {
  margin: 0 0 2px;
  color: var(--tomato-dark);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .1em;
}

.recipe-heading h3 { margin: 0; font-size: 1.25rem; }
.recipe-block { margin-top: 16px; }
.recipe-block h4 { margin: 0 0 7px; font-size: .95rem; }
.recipe-block p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.7; }
.shopping-generate { width: 100%; margin-top: 14px; padding: 11px; color: #6d4934; background: #fff4d4; border: 1px solid #d9b76e; border-radius: 12px; font-size: .85rem; font-weight: 900; }
.shopping-list { margin-top: 14px; padding: 14px; border: 1px solid #a8cbb8; border-radius: 14px; background: #eff9f3; text-align: left; }
.shopping-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.shopping-list-heading span { color: #42805f; font-size: .67rem; font-weight: 800; }
.shopping-list-heading h4 { margin: 2px 0 0; font-size: 1rem; }
.shopping-list-heading button { padding: 5px 7px; border: 1px solid #9cbbaa; border-radius: 8px; background: #fff; color: #47735d; font-size: .65rem; font-weight: 800; }
#shopping-list-items { margin-top: 10px; }
#shopping-list-items label { display: flex; align-items: flex-start; gap: 9px; padding: 9px 4px; border-bottom: 1px dashed #c8ded1; color: #433e39; font-size: .82rem; font-weight: 700; line-height: 1.45; }
#shopping-list-items label:last-child { border-bottom: 0; }
#shopping-list-items input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: #2f9466; }
#shopping-list-items label.is-checked span { color: #8b938e; text-decoration: line-through; }
.shopping-list > p { margin: 9px 0 0; color: #738078; font-size: .66rem; line-height: 1.45; }
.recipe-start-cooking { width: 100%; margin-top: 15px; padding: 12px; color: #fff; background: #2f8f63; border-color: #245f45; border-radius: 12px; font-size: .9rem; font-weight: 900; }
.cooking-mode { margin-top: 16px; padding: 15px; background: #f1fbf4; border: 1.5px solid #5b8c68; border-radius: 14px; }
.cooking-mode-heading { display: flex; align-items: flex-start; justify-content: space-between; }
.cooking-mode-heading span { color: #4e765a; font-size: .68rem; font-weight: 900; letter-spacing: .08em; }
.cooking-mode-heading h4 { margin: 3px 0 0; font-size: 1rem; }
.cooking-mode-heading strong { flex: 0 0 auto; margin-left: 10px; color: #2f8f63; font-size: .8rem; }
.cooking-progress-track { height: 8px; margin-top: 11px; overflow: hidden; background: #dcebdd; border-radius: 999px; }
.cooking-progress-track span { display: block; width: 0; height: 100%; background: #2f8f63; border-radius: inherit; transition: width .25s ease; }
.cooking-step-visual { margin: 13px 0 0; overflow: hidden; background: #fff; border: 1px solid #cddfce; border-radius: 12px; }
.cooking-step-visual .recipe-sprite-frame { min-height: 150px; }
.cooking-step-text { min-height: 78px; margin: 14px 0; color: #403a35; font-size: .95rem; font-weight: 700; line-height: 1.7; }
.cooking-step-actions { display: grid; grid-template-columns: .8fr 1.2fr; grid-gap: 8px; }
.cooking-step-actions button { padding: 10px; background: #fff; border-radius: 10px; font-weight: 800; }
.cooking-step-actions #cooking-next { color: #fff; background: #2f8f63; border-color: #245f45; }
.cooking-step-actions button:disabled { opacity: .42; }
.cooking-save-note { margin: 9px 0 0; color: #6f8373; font-size: .68rem; text-align: center; }
.recipe.is-cooking .recipe-visual { display: none; }
.draw-button:disabled, .accept-button:disabled, .retry-button:disabled, .exclude-button:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

.recipe-visual {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #e8dfc9;
}

.recipe-visual-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.recipe-visual-heading h4 { margin: 0; font-size: .95rem; }
.recipe-visual-heading span { color: var(--muted); font-size: .72rem; font-weight: 700; }

.recipe-gallery {
  display: flex;
  overflow-x: auto;
  padding: 0 0 8px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}

.recipe-gallery::-webkit-scrollbar { display: none; }

.recipe-gallery figure {
  position: relative;
  width: 88%;
  min-width: 88%;
  margin: 0 10px 0 0;
  overflow: hidden;
  background: #fff8e9;
  border: 1px solid #e8dfc9;
  border-radius: 15px;
  scroll-snap-align: start;
}

.recipe-step-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 7px 10px;
  color: #552318;
  background: rgba(255, 252, 241, .94);
  border: 1px solid rgba(95, 55, 39, .16);
  border-radius: 9px;
  font-size: .82rem;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(65, 35, 20, .12);
}

.recipe-sprite-frame {
  display: block;
  width: 100%;
  background: #f5ead4;
  background-repeat: no-repeat;
}

.recipe-gallery figcaption { padding: 11px 12px 13px; }
.recipe-gallery figcaption strong { display: block; margin-bottom: 4px; color: var(--tomato-dark); font-size: .86rem; }
.recipe-gallery figcaption span { display: block; color: #5f574f; font-size: .8rem; line-height: 1.55; }

.recipe-gallery-dots { display: flex; justify-content: center; margin-top: 2px; }
.recipe-gallery-dots i { width: 6px; height: 6px; margin: 0 3px; background: #d9cfb9; border-radius: 50%; }
.recipe-gallery-dots i.is-active { width: 17px; background: var(--tomato); border-radius: 999px; }

.calorie-note {
  margin: 16px 0 0;
  padding-top: 12px;
  color: #8a8178;
  border-top: 1px solid #e8dfc9;
  font-size: .78rem;
  line-height: 1.55;
}

.finish-checkin {
  margin-top: 17px;
  padding: 14px;
  background: #fff4c7;
  border: 1px solid #e0cf8c;
  border-radius: 13px;
}
.finish-checkin h4 { margin: 0 0 3px; font-size: .9rem; }
.finish-checkin p { margin: 0 0 10px; color: var(--muted); font-size: .76rem; }
.finish-checkin > button { width: 100%; padding: 10px; color: #fff; background: #2f8f63; border-color: #245f45; border-radius: 10px; }
.finish-checkin > button:disabled { opacity: .72; }
.eaten-success { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid #e0cf8c; }
.eaten-success span { color: #276b49; font-size: .78rem; font-weight: 800; }
.eaten-success button { padding: 5px 8px; color: #6c5e43; background: #fff; border-color: #c7b579; font-size: .7rem; }

.celebration-layer { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 9999; overflow: hidden; pointer-events: none; }
.celebration-message { position: absolute; top: 42%; left: 50%; width: max-content; max-width: 82vw; padding: 12px 17px; color: #fff; background: rgba(34, 34, 34, .9); border: 2px solid #fff; border-radius: 999px; box-shadow: 4px 5px 0 rgba(34, 34, 34, .35); font-size: .95rem; font-weight: 900; text-align: center; transform: translate(-50%, -50%); animation: celebrationMessage 2.2s ease both; }
.firework-burst { position: absolute; width: 6px; height: 6px; }
.firework-spark { position: absolute; width: 7px; height: 7px; background: #ff6652; border-radius: 50%; box-shadow: 0 0 6px currentColor; animation: fireworkSpark 1s ease-out both; }
.celebration-confetti { position: absolute; top: -18px; width: 8px; height: 14px; border-radius: 2px; animation: celebrationFall 1.8s ease-in both; }
@keyframes fireworkSpark {
  0% { opacity: 1; transform: translate(0, 0) scale(.4); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--spark-x), var(--spark-y)) scale(1); }
}
@keyframes celebrationFall {
  0% { opacity: 1; transform: translateY(-10px) rotate(0); }
  100% { opacity: 0; transform: translateY(105vh) rotate(620deg); }
}
@keyframes celebrationMessage {
  0% { opacity: 0; transform: translate(-50%, -35%) scale(.75); }
  15%, 75% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -65%) scale(.95); }
}
@media (prefers-reduced-motion: reduce) {
  .firework-spark, .celebration-confetti { display: none; }
  .celebration-message { animation-duration: 1.2s; }
}

.accept-button.is-accepted { background: #2f8f63; }

.empty-message {
  margin: 24px 0 0;
  padding: 14px;
  color: #7a342b;
  background: #ffe2dc;
  border: 1.5px dashed var(--tomato-dark);
  border-radius: 14px;
  text-align: center;
  font-weight: 700;
}

.footer-note { margin: 20px 0 0; color: var(--muted); font-size: .8rem; text-align: center; }

@keyframes reveal {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to { opacity: 1; transform: none; }
}

@keyframes pop {
  50% { transform: scale(1.04) rotate(-1deg); }
}

@media (min-width: 560px) {
  .app-shell {
    padding-top: 48px;
    padding-top: calc(48px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px)));
  }
  .picker-card { padding: 36px 34px 28px; }
  h1 { font-size: 2.8rem; }
  .result-actions { grid-template-columns: .85fr 1.15fr; }
  .result-actions .exclude-button { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.random-test-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow: auto;
  padding: 24px;
  background: #fff8e8;
  color: #29241f;
}

.random-test-panel {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 24px;
  border: 3px solid #29241f;
  border-radius: 28px;
  background: #fffdf8;
  box-shadow: 8px 8px 0 #29241f;
}

.random-test-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.random-test-header p {
  margin: 0 0 6px;
  color: #df4a3b;
  font-weight: 800;
}

.random-test-header h2 {
  margin: 0;
  font-size: clamp(20px, 4vw, 34px);
}

.random-test-progress {
  display: grid;
  flex: 0 0 auto;
  text-align: right;
}

.random-test-progress strong {
  color: #239665;
  font-size: 28px;
}

.random-test-progress span {
  color: #746b62;
}

.random-test-bar {
  height: 14px;
  margin: 20px 0;
  overflow: hidden;
  border: 2px solid #29241f;
  border-radius: 999px;
  background: #eee5d3;
}

.random-test-bar span {
  display: block;
  width: 0;
  height: 100%;
  background: #2f9a6c;
  transition: width 120ms ease;
}

.random-test-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-height: 65vh;
  overflow: auto;
  padding: 4px;
}

.random-test-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #ddd3c3;
  border-radius: 12px;
  background: #fff;
  font-size: 14px;
}

.random-test-item b {
  flex: 0 0 auto;
  color: #9b9288;
}

.random-test-item.is-checked {
  border-color: #7bc7a4;
  background: #e2f7ed;
}

.random-test-item.is-checked b {
  color: #14784e;
}

.random-test-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.random-test-actions button,
.random-test-actions a {
  padding: 12px 18px;
  border: 2px solid #29241f;
  border-radius: 14px;
  background: #fff;
  color: #29241f;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
}

.random-test-panel.is-complete {
  box-shadow: 8px 8px 0 #239665;
}

.ingredient-test-selection {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  margin-top: 18px;
  padding: 10px 14px;
  border: 2px dashed #ef9c84;
  border-radius: 14px;
  background: #fff4ed;
}

.ingredient-test-selection span {
  flex: 0 0 auto;
  color: #9c4937;
  font-weight: 800;
}

.ingredient-test-selection strong {
  color: #29241f;
}

@media (max-width: 700px) {
  .random-test-overlay { padding: 12px; }
  .random-test-panel { padding: 16px; }
  .random-test-header { align-items: flex-start; }
  .random-test-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .random-test-item { font-size: 12px; }
}
