/* Cozy Kitchen — R&D menu: pick a dish, see how to cook it in picture steps. Palette follows menu-abit. */

:root {
  --bg: #fbf6ee;
  --paper: #fffdf9;
  --ink: #3b2f2a;
  --ink-soft: #7a6a60;
  --line: #e6d9c8;
  --accent: #c8643b;
  --accent-soft: #f6e1d3;
  --sage: #6f8f6a;
  --plum: #6b4a8a;
  --night: #3c3346;
  --hit: #ffe9a8;
  --glow: #fff3c9;
  --shadow: 0 1px 2px rgba(59, 47, 42, .06), 0 4px 14px rgba(59, 47, 42, .05);
  --radius: 14px;
  --bar-h: 58px;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1916;
    --paper: #26211d;
    --ink: #f1e7dc;
    --ink-soft: #b3a497;
    --line: #3d342d;
    --accent: #ec8a5e;
    --accent-soft: #43302a;
    --sage: #9cbd95;
    --plum: #b59ad1;
    --hit: #5a4a1c;
    --glow: #4a3d22;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
a { color: inherit; text-decoration: none; }
code { font-size: .85em; background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; }
img { max-width: 100%; }
.noimg { display: inline-block; background: var(--line); border-radius: 8px; }

/* ---- header & toolbar ------------------------------------------------------------- */
.hero { padding: 32px 0 14px; }
.eyebrow { margin: 0; color: var(--accent); font-weight: 800; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; }
h1 { margin: 4px 0 4px; font-size: 38px; font-weight: 900; letter-spacing: -.01em; }
.stats { margin: 0; color: var(--ink-soft); font-weight: 600; }

.toolbar {
  position: sticky; top: 0; z-index: 5; min-height: var(--bar-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 10px; padding-bottom: 10px; }
#q {
  flex: 1 1 260px; min-width: 0; padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: inherit;
}
#q:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button, select {
  font: inherit; font-weight: 700; font-size: 13px; padding: 7px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
}
select { max-width: 260px; }
button:hover { border-color: var(--accent); }
.seg { display: inline-flex; }
.seg button { border-radius: 0; margin-left: -1px; }
.seg button:first-child { border-radius: 999px 0 0 999px; }
.seg button:last-child { border-radius: 0 999px 999px 0; }
.seg button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.howto-link { font-size: 13px; font-weight: 800; color: var(--accent); margin-left: auto; }

/* ---- two-column layout -------------------------------------------------------------- */
.layout {
  display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 20px; align-items: start;
  max-width: 1280px; margin: 0 auto; padding: 16px;
}
.list {
  position: sticky; top: calc(var(--bar-h) + 12px); height: calc(100dvh - var(--bar-h) - 28px); overflow-y: auto;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 6px;
}
.detail { scroll-margin-top: calc(var(--bar-h) + 12px); }
.hits { margin: 4px 8px 6px; color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.row {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px;
  content-visibility: auto; contain-intrinsic-size: auto 60px;
}
.row[hidden] { display: none; }
.row:hover { background: var(--accent-soft); }
.row.on { background: var(--hit); box-shadow: inset 3px 0 0 var(--accent); }
.thumb { width: 46px; height: 46px; object-fit: contain; flex: none; }
.rname { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.2; }
.rname b { font-weight: 800; font-size: 14px; }
.rname small, h2 small { color: var(--ink-soft); font-weight: 600; font-size: 12px; }
.minis { display: flex; gap: 3px; margin-top: 3px; }
.mini { width: 20px; height: 20px; object-fit: contain; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.t-n { background: var(--sage); }
.t-d { background: var(--night); }
.t-m { background: var(--plum); }

footer { color: var(--ink-soft); font-size: 13px; padding: 20px 16px 40px; border-top: 1px solid var(--line); }

/* ---- shared bits ----------------------------------------------------------------------- */
.badge, .chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800;
  border-radius: 999px; padding: 3px 12px 3px 6px;
}
.badge { color: #fff; }
.b-n { background: var(--sage); }
.b-d { background: var(--night); }
.b-m { background: var(--plum); }
.bico { width: 26px; height: 20px; object-fit: contain; filter: brightness(0) invert(1); }
.chip { background: var(--accent-soft); border: 1px solid transparent; color: var(--ink); }
button.chip { padding: 3px 12px; }
.avatar { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; flex: none; }
.avatar.sm { width: 22px; height: 22px; border-radius: 6px; }
.meta { color: var(--ink-soft); font-size: 13px; margin: 0; }

/* image card: picture with its name underneath */
.icard {
  display: inline-flex; flex-direction: column; align-items: center; gap: 4px; width: 92px; text-align: center;
}
.icard .iimg { width: 72px; height: 72px; object-fit: contain; }
.icard .iname { font-size: 12px; font-weight: 800; line-height: 1.2; }
.icard.sm { width: 64px; }
.icard.sm .iimg { width: 44px; height: 44px; }
.icard.lg .iimg { width: 88px; height: 88px; }
.icard.target .iimg { filter: drop-shadow(0 0 10px var(--hit)); }
.icard.result .iimg { width: 92px; height: 92px; }
.tagcard .iimg { border-radius: 10px; }

/* ---- detail: hero ------------------------------------------------------------------------- */
.dish-hero, .step, .intro {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.dish-hero { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; padding: 18px; align-items: center; }
.plate {
  aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle, var(--glow) 0 45%, var(--accent-soft) 46% 70%, transparent 71%);
}
.plate.ty-d { background: radial-gradient(circle, #5b4d6a 0 45%, var(--night) 46% 70%, transparent 71%); }
.plate.ty-m { background: radial-gradient(circle, var(--glow) 0 45%, color-mix(in srgb, var(--plum) 30%, var(--paper)) 46% 70%, transparent 71%); }
.hero-img { width: 74%; height: 74%; object-fit: contain; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .15)); }
.dish-info h2 { margin: 0; font-size: 28px; font-weight: 900; line-height: 1.15; display: flex; flex-direction: column; }
.dish-info h2 small { font-size: 15px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.equation { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.op { font-size: 28px; font-weight: 900; color: var(--accent); padding: 0 2px 22px; }

/* ---- detail: steps ---------------------------------------------------------------------------- */
.steps { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 14px; counter-reset: s; }
.step { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; padding: 16px 18px; }
.step-num {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 900; font-size: 19px;
}
.step-body h3 { margin: 6px 0 4px; font-size: 19px; font-weight: 900; }
.step-body > p { margin: 0 0 10px; color: var(--ink-soft); }
.step-body > p b { color: var(--ink); }
.visual { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ingredient prep cards */
.preps { display: grid; gap: 10px; width: 100%; }
.prep { border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; background: var(--bg); }
.prep-head { display: flex; align-items: center; gap: 12px; }
.pimg { width: 60px; height: 60px; object-fit: contain; flex: none; }
.pname { display: flex; flex-direction: column; line-height: 1.2; }
.pname b { font-size: 16px; font-weight: 900; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700;
  border-radius: 999px; padding: 1px 8px 1px 2px; background: var(--paper); border: 1px solid var(--line); color: var(--ink-soft);
}
.tag.main { color: var(--ink); border-color: var(--accent); font-weight: 900; }
.tico { width: 18px; height: 18px; object-fit: contain; border-radius: 4px; }
.origin { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; font-size: 14px; line-height: 1.9; }
.oico { width: 34px; height: 34px; object-fit: contain; }
.dlink {
  display: inline-flex; align-items: center; gap: 4px; font-weight: 800; color: var(--accent);
  background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px 1px 3px;
  vertical-align: middle; line-height: 1.4;
}
.dlink:hover { border-color: var(--accent); }
.dthumb { width: 24px; height: 24px; object-fit: contain; }

.chain { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-top: 10px; }
.via { display: inline-flex; align-items: center; gap: 2px; flex-direction: row; position: relative; padding-bottom: 16px; }
.vimg { width: 56px; height: 44px; object-fit: contain; }
.vtxt { position: absolute; bottom: 0; left: 0; right: 0; text-align: center; font-size: 11px; font-weight: 800; color: var(--ink-soft); }
.arrow { width: 26px; height: 12px; fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.chain-say { margin: 6px 0 0; padding-left: 20px; font-size: 13px; color: var(--ink-soft); }
.chain-say b { color: var(--ink); }
.unlock {
  display: flex; align-items: center; gap: 12px; margin-top: 10px; width: 100%;
  border-radius: 12px; padding: 8px 12px; background: var(--hit);
}
.unlock .origin { margin-top: 4px; }
.uimg { width: 64px; height: 50px; object-fit: contain; flex: none; }

/* messy: one slot per group */
.slots { display: grid; gap: 10px; width: 100%; }
.slot { display: flex; gap: 14px; align-items: flex-start; border: 1px dashed var(--line); border-radius: 12px; padding: 10px; background: var(--bg); }
.slot-opts { display: flex; flex-wrap: wrap; gap: 4px; align-items: flex-start; }
.slot-opts .meta { flex-basis: 100%; }

/* pot: ingredients drop into the open pot */
.pot-stage { position: relative; width: 300px; max-width: 100%; padding-top: 86px; margin: 0 auto; }
.pot-stage .pot { width: 100%; display: block; }
.drops { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: center; gap: 14px; }
.drop { animation: drop 2.4s ease-in infinite; animation-delay: calc(var(--i) * .5s); }
.dimg { width: 66px; height: 66px; object-fit: contain; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .15)); }
@keyframes drop {
  0%, 15% { transform: translateY(0); opacity: 1; }
  60% { transform: translateY(84px) scale(.75); opacity: 1; }
  72%, 100% { transform: translateY(96px) scale(.6); opacity: 0; }
}
.cook-stage { position: relative; width: 300px; max-width: 100%; margin: 0 auto; }
.cook-stage .pot { width: 100%; display: block; animation: rattle .5s ease-in-out infinite; }
@keyframes rattle { 0%, 100% { transform: rotate(-1.5deg); } 50% { transform: rotate(1.5deg); } }
.tap {
  position: absolute; right: 18%; bottom: 8%; font-size: 40px; line-height: 1;
  animation: tap 1.2s ease-in-out infinite; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .25));
}
@keyframes tap { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* serve: the finished dish, like the game's reveal */
.serve {
  position: relative; display: grid; justify-items: center; width: 320px; max-width: 100%; margin: 0 auto; padding: 8px 0 4px;
  background: radial-gradient(circle at 50% 60%, var(--glow) 0 38%, transparent 62%);
}
.ribbon {
  background: var(--plum); color: #fff; font-weight: 900; letter-spacing: .03em; text-transform: uppercase;
  padding: 6px 18px; border-radius: 8px; font-size: 15px; text-align: center; box-shadow: var(--shadow);
}
.serve-img { width: 210px; height: 190px; object-fit: contain; margin-top: 8px; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .15)); }
.new-stamp { position: absolute; top: 34px; right: 4px; width: 70px; transform: rotate(12deg); }

/* ---- intro (nothing picked) -------------------------------------------------------------------- */
.intro { padding: 20px; }
.intro h2 { margin: 0 0 2px; font-size: 26px; font-weight: 900; }
.hows { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 14px; }
.how { margin: 0; background: var(--bg); border-radius: 12px; padding: 12px; }
.how-img { width: 100%; height: 200px; object-fit: contain; }
.how figcaption { font-size: 14px; }

@media (max-width: 860px) {
  .toolbar { position: static; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .list { position: static; height: 42dvh; }
  .howto-link { margin-left: 0; }
  .dish-hero { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .plate { width: 200px; }
  .badges, .equation { justify-content: center; }
  .step { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  .drop, .cook-stage .pot, .tap { animation: none; }
}
