/* Feed the Chonk — warm, cozy, sticker-like theme */
:root{
  --accent:#ff9d72;
  --accent2:#80c9bd;
  --text:#3b2f35;
  --panel:rgba(255,250,245,0.96);
  --panel-border:rgba(59,47,53,0.08);
  --shadow:0 8px 32px rgba(59,47,53,0.18);
  --radius:18px;
  --safe-bottom:env(safe-area-inset-bottom, 0px);
  --safe-top:env(safe-area-inset-top, 0px);
}
*{box-sizing:border-box}
html,body{height:100%;margin:0;overflow:hidden}
body{
  font:16px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  color:var(--text);
  background:#fff6ee;
}

/* Background layer — isolated fallback gradient */
#bg-layer{position:fixed;inset:0;z-index:0;overflow:hidden}
#bg-fallback{
  position:absolute;inset:0;
  background:
    radial-gradient(ellipse 90% 70% at 20% 20%, #fff2e0 0%, transparent 60%),
    radial-gradient(ellipse 80% 60% at 85% 15%, #ffe0e8 0%, transparent 55%),
    radial-gradient(ellipse 70% 50% at 50% 85%, #e0f0e8 0%, transparent 60%),
    linear-gradient(180deg, #fff8f0 0%, #ffe8d0 40%, #ffd8b8 100%);
}
#bg-image{
  position:absolute;inset:0;width:100%;height:100%;
  object-fit:cover;object-position:50% 50%;
  display:none;
}
#bg-image.has-src{display:block}
#bg-overlay{position:absolute;inset:0;background:rgba(255,255,255,0.04)}

/* Game root */
#game-root{
  position:relative;z-index:1;
  height:100vh;height:100dvh;
  display:flex;flex-direction:column;
  padding-top:var(--safe-top);
  padding-bottom:var(--safe-bottom);
}

/* HUD */
#hud{
  display:flex;align-items:center;justify-content:space-between;
  gap:8px;
  padding:10px 14px;
  margin:8px 10px 0;
  background:var(--panel);
  border:1px solid var(--panel-border);
  border-radius:16px;
  box-shadow:var(--shadow);
  backdrop-filter:blur(8px);
}
.hud-left,.hud-right{display:flex;gap:14px;align-items:center}
.hud-center{flex:0 0 auto}
.hud-stat{display:flex;flex-direction:column;align-items:center;line-height:1.1}
.hud-label{font-size:0.68rem;letter-spacing:0.06em;text-transform:uppercase;opacity:0.6;font-weight:700}
.hud-value{font-size:1.05rem;font-weight:800;min-width:2ch;text-align:center}
.hud-value#hud-timer{font-size:1.25rem;color:#c04a2a}
#hud-combo-wrap{transition:transform 0.2s}
#hud-combo-wrap.pop{transform:scale(1.15)}
#hud-combo{color:var(--accent)}

/* Cat stage */
#cat-stage{
  flex:1;
  display:flex;align-items:center;justify-content:center;
  padding:14px 14px 8px;
  min-height:0;
  overflow:hidden;
}
#cat-wrap{
  position:relative;
  width:min(68vw, 520px);
  aspect-ratio:1;
  display:flex;align-items:center;justify-content:center;
  transition:transform 0.18s cubic-bezier(0.34,1.56,0.64,1);
}
#cat-wrap.bounce{transform:scale(1.04)}
#cat-wrap.breathing{animation:breath 2.8s ease-in-out infinite}
@keyframes breath{0%,100%{transform:scale(1)}50%{transform:scale(1.015)}}
@media (prefers-reduced-motion: reduce){
  #cat-wrap.breathing{animation:none}
  #cat-wrap.bounce{transform:none}
}

#cat-image{
  position:absolute;inset:0;width:100%;height:100%;
  object-fit:contain;object-position:50% 92%;
  display:none;pointer-events:none;
  filter:drop-shadow(0 10px 22px rgba(0,0,0,0.18));
}
#cat-image.has-src{display:block}
#cat-fallback{
  width:100%;height:100%;display:flex;align-items:center;justify-content:center;
  transition:transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  transform-origin:50% 78%;
  will-change:transform;
}
#cat-fallback.hidden{display:none}
.cat-body{
  width:78%;aspect-ratio:1;
  --cb-top:#b8c0c8; --cb-mid:#9aa3ad; --cb-bottom:#8d959f;
  --belly:rgba(255,255,255,0.42);
  --ear-outer:#9aa3ad; --ear-inner:#e8c0c8;
  --paw-bg:#f0c2c8; --paw-pad:rgba(232,130,145,0.44); --toe-bg:rgba(232,130,145,0.40);
  --nose-bg:#e8a0a8; --cheek-bg:rgba(232,160,168,0.38); --whisker:rgba(59,47,53,0.30); --line:#3b2f35;
  --stripe:transparent;
  background:linear-gradient(180deg,var(--cb-top) 0%, var(--cb-mid) 55%, var(--cb-bottom) 100%);
  border-radius:50% 50% 46% 46% / 58% 58% 42% 42%;
  position:relative;
  box-shadow:inset 0 8px 20px rgba(255,255,255,0.35), 0 12px 28px rgba(0,0,0,0.18);
  display:flex;flex-direction:column;align-items:center;justify-content:flex-start;
  padding-top:14%;
}
/* Ginger Chonk skin — same geometry, distinct warm palette */
.cat-body[data-cat="ginger-chonk"]{
  --cb-top:#F2A45F; --cb-mid:#E8934A; --cb-bottom:#CF7137;
  --belly:#F7D9AD;
  --ear-outer:#E8934A; --ear-inner:#F3A3A0;
  --paw-bg:#F6B29E; --paw-pad:#D98282; --toe-bg:#D98282;
  --nose-bg:#E9827D; --cheek-bg:#EFA08D; --whisker:rgba(109,73,63,0.42); --line:#6D493F;
  --stripe:#B85E31;
}
.cat-body.happy{background:linear-gradient(180deg,#c2cbd3 0%, #a8b1bb 55%, #95a0ab 100%)}
.cat-body[data-cat="ginger-chonk"].happy{background:linear-gradient(180deg,#F6B67A 0%, #E99B55 55%, #DD7E3A 100%)}
.cat-body.hungry{filter:saturate(0.7) brightness(0.95)}
.cat-body.panic{filter:saturate(1.2) hue-rotate(-6deg)}
.cat-body.chewing{transform:scaleY(0.98)}
.cat-ears{display:flex;gap:36%;width:66%;justify-content:center;margin-bottom:1%;position:relative;z-index:1}
.cat-ears span{width:24%;aspect-ratio:0.86;background:var(--ear-outer);position:relative;transform-origin:50% 88%;clip-path:polygon(44% 1%,56% 1%,95% 97%,89% 100%,11% 100%,5% 97%)}
.cat-ears span:first-child{transform:rotate(-9deg)}
.cat-ears span:last-child{transform:rotate(9deg)}
.cat-ears span::after{content:"";position:absolute;inset:26% 24% 12% 24%;background:var(--ear-inner);clip-path:polygon(43% 2%,57% 2%,94% 97%,88% 100%,12% 100%,6% 97%)}
.cat-face{width:70%;display:flex;flex-direction:column;align-items:center;gap:5px;position:relative}
.eyes{display:flex;gap:24%;width:60%;justify-content:center}
.eye{width:18px;height:19px;background:#2b2326;border-radius:50%;position:relative;box-shadow:0 1px 3px rgba(0,0,0,0.3)}
.eye::after{content:"";position:absolute;top:3.5px;left:4px;width:6px;height:6px;background:white;border-radius:50%;opacity:0.92}
.nose{width:13px;height:8px;background:var(--nose-bg);clip-path:polygon(50% 100%, 0% 18%, 10% 4%, 90% 4%, 100% 18%);border-radius:2px;margin-top:1px}
.mouth{width:36px;height:14px;border-radius:0 0 46% 46% / 0 0 88% 88%;border-bottom:2.6px solid var(--line);opacity:0.84}
.mouth.happy{width:39px;border-bottom-width:2px;border-left:2px solid var(--line);border-right:2px solid var(--line);height:17px}
.mouth.panic{width:22px;height:22px;border:2px solid var(--line);border-radius:50%;border-bottom-color:transparent}
.cheeks{display:flex;gap:22%;width:74%;justify-content:center;margin-top:3px}
.cheeks span{width:22px;height:10px;background:var(--cheek-bg);border-radius:50%;filter:blur(0.2px)}
.whiskers{position:absolute;left:-6%;right:-6%;top:42%;height:38px;pointer-events:none}
.whisker{position:absolute;width:20px;height:1.6px;background:var(--whisker);border-radius:999px}
.whisker.l1{left:2%;top:4px;transform:rotate(-11deg)}
.whisker.l2{left:0%;top:14px;transform:rotate(-2deg)}
.whisker.l3{left:2%;top:24px;transform:rotate(11deg)}
.whisker.r1{right:2%;top:4px;transform:rotate(11deg)}
.whisker.r2{right:0%;top:14px;transform:rotate(2deg)}
.whisker.r3{right:2%;top:24px;transform:rotate(-11deg)}
.cat-stripes{position:absolute;inset:0;pointer-events:none;overflow:visible}
.stripe-forehead{position:absolute;left:50%;top:13%;width:44%;height:14px;transform:translateX(-50%);display:flex;gap:7%;justify-content:center}
.stripe-forehead span{flex:0 0 14%;height:100%;background:var(--stripe);border-radius:999px;opacity:0.72;transform:rotate(0deg)}
.stripe-forehead span:nth-child(1){transform:rotate(-18deg) translateY(2px);height:86%}
.stripe-forehead span:nth-child(2){height:100%}
.stripe-forehead span:nth-child(3){transform:rotate(18deg) translateY(2px);height:86%}
.stripe-side{position:absolute;top:34%;width:14px;height:42px;display:flex;flex-direction:column;gap:6px}
.stripe-side.left{left:9%}
.stripe-side.right{right:9%;transform:scaleX(-1)}
.stripe-side span{flex:0 0 16px;height:8px;background:var(--stripe);border-radius:999px;opacity:0.58;transform:rotate(-12deg)}
.stripe-side span:nth-child(2){opacity:0.48;transform:rotate(-8deg) translateX(2px)}
.cat-body[data-cat="grey-chonk"] .stripe-forehead span,
.cat-body[data-cat="grey-chonk"] .stripe-side span{opacity:0}
.cat-belly{width:64%;height:28%;background:var(--belly);border-radius:50%;margin-top:6%}
.cat-paws{
  position:absolute;
  left:50%;bottom:3%;
  transform:translateX(-50%);
  width:68%;
  display:flex;justify-content:center;gap:14%;
  pointer-events:none;
}
.paw{
  flex:0 0 34%;
  aspect-ratio:1.25;
  background:var(--paw-bg);
  border-radius:50% 50% 44% 44% / 58% 58% 38% 38%;
  position:relative;
  box-shadow:inset 0 5px 10px rgba(255,255,255,0.55), 0 4px 10px rgba(59,47,53,0.12);
  border:1px solid rgba(59,47,53,0.06);
}
.paw-pad{
  position:absolute;
  left:50%;top:38%;
  transform:translateX(-50%);
  width:42%;height:30%;
  background:var(--paw-pad);
  border-radius:50%;
}
.toe{
  position:absolute;
  width:19%;height:19%;
  background:var(--toe-bg);
  border-radius:50%;
}
.toe.t1{left:13%;top:14%}
.toe.t2{left:50%;top:7%;transform:translateX(-50%)}
.toe.t3{right:13%;top:14%}

#cat-hit{
  position:absolute;inset:0;
  border:none;background:transparent;cursor:pointer;
  border-radius:50%;-webkit-tap-highlight-color:transparent;
}
#cat-hit:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
#cat-grid{
  position:absolute;inset:0;border:1px dashed rgba(255,100,50,0.5);pointer-events:none;
}
#cat-grid.hidden{display:none}
#cat-grid::before,#cat-grid::after{content:"";position:absolute;background:rgba(255,100,50,0.25)}
#cat-grid::before{left:50%;top:0;bottom:0;width:1px}
#cat-grid::after{top:50%;left:0;right:0;height:1px}
#floating-layer{position:absolute;inset:0;pointer-events:none;overflow:visible}
.float-label{
  position:absolute;left:50%;top:34%;
  transform:translate(-50%,0);
  background:var(--panel);color:var(--text);
  padding:6px 12px;border-radius:999px;font-weight:800;font-size:0.95rem;
  box-shadow:var(--shadow);border:1px solid var(--panel-border);
  animation:floatUp 0.9s ease-out forwards;
}
@keyframes floatUp{0%{opacity:0;transform:translate(-50%,8px) scale(0.9)}15%{opacity:1}100%{opacity:0;transform:translate(-50%,-42px) scale(1)}}

/* Held preview — visible slot near cat */
#held-slot{
  display:flex;justify-content:center;
  padding:0 10px;
  min-height:0;
}
#held-slot.hidden{display:none}
.held-card{
  display:flex;align-items:center;gap:10px;
  background:var(--panel);
  border:2px solid var(--accent);
  border-radius:999px;
  padding:6px 14px 6px 8px;
  box-shadow:0 4px 18px rgba(0,0,0,0.14), 0 0 0 4px rgba(255,157,114,0.25);
  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
  transition:transform 0.15s;
  min-height:44px;
}
.held-card:active{transform:scale(0.97)}
.held-card:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
.held-thumb{width:38px;height:38px;object-fit:contain;display:none}
.held-thumb.has-src{display:block}
.held-emoji{font-size:26px;line-height:1;display:none}
.held-name{font-weight:800;font-size:0.9rem;white-space:nowrap}
.held-hint{font-size:0.68rem;opacity:0.6;white-space:nowrap}
@media (max-width: 380px){ .held-hint{display:none} }

/* Food lane — ticker/conveyor */
#food-lane{
  margin:0 10px;
  background:var(--panel);
  border:1px solid var(--panel-border);
  border-radius:18px;
  box-shadow:var(--shadow);
  padding:10px 8px 12px;
  min-height:96px;
  overflow:hidden;
}
#food-track{
  position:relative;
  height:78px;
  overflow:hidden;
  touch-action:pan-y;
  /* isolation for absolute items; clip items but leave enough inner space so glow not harshly cut */
}
.food-item{
  position:absolute;
  top:2px;
  width:72px;height:72px;
  border-radius:16px;
  border:2px solid transparent;
  background:white;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  cursor:pointer;
  box-shadow:0 2px 10px rgba(0,0,0,0.08);
  transition:border-color 0.12s, box-shadow 0.12s;
  -webkit-tap-highlight-color:transparent;
  user-select:none;
  will-change:left;
}
.food-item:focus-visible{outline:3px solid var(--accent);outline-offset:1px}
.food-item[aria-pressed="true"]{border-color:var(--accent)}
.food-item.held-dim{opacity:0.45;pointer-events:none}
.food-thumb{width:46px;height:46px;object-fit:contain;display:block}
.food-thumb.hidden{display:none}
.food-emoji{font-size:36px;line-height:1}
.food-name{font-size:0.62rem;font-weight:700;opacity:0.7;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:68px;text-align:center}
.food-rarity{position:absolute;top:4px;right:5px;width:8px;height:8px;border-radius:50%}
/* When real food art exists — remove opaque white card, show illustration prominently */
.food-item.has-image{
  background:transparent;
  border-color:transparent;
  box-shadow:none;
  border-radius:12px;
}
.food-item.has-image .food-thumb{
  width:64px;height:64px;
  object-fit:contain;
  filter:drop-shadow(0 3px 8px rgba(59,47,53,0.18));
}
.food-item.has-image .food-name{display:none}
.food-item.has-image .food-rarity{top:2px;right:2px}
.food-rarity.common{background:#9ec9a8}
.food-rarity.uncommon{background:#7ab8e8}
.food-rarity.rare{background:#e8a84a;border:1px solid #d48c20}

/* Controls */
#controls{
  display:flex;gap:8px;justify-content:center;
  padding:8px 10px calc(10px + var(--safe-bottom));
}
.btn{
  appearance:none;border:none;cursor:pointer;
  background:white;color:var(--text);
  padding:10px 18px;border-radius:999px;
  font-weight:700;font-size:0.92rem;
  box-shadow:0 2px 10px rgba(0,0,0,0.08);
  border:1px solid var(--panel-border);
  min-height:44px;min-width:44px;
  transition:transform 0.1s, box-shadow 0.1s;
}
.btn:active{transform:scale(0.97)}
.btn:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
.btn.primary{background:var(--accent);color:white;border-color:transparent;box-shadow:0 4px 16px rgba(255,157,114,0.4)}
.btn.primary:hover{filter:brightness(1.05)}
.btn.small{padding:8px 14px;font-size:0.82rem}

/* Overlays */
.overlay{
  position:fixed;inset:0;z-index:10;
  display:none;align-items:center;justify-content:center;
  padding:18px;
  background:rgba(59,47,53,0.42);
  backdrop-filter:blur(6px);
}
.overlay.active{display:flex}
.overlay .panel{
  background:var(--panel);
  border:1px solid var(--panel-border);
  border-radius:20px;
  box-shadow:0 18px 48px rgba(0,0,0,0.22);
  padding:22px 20px;
  width:min(420px, 100%);
  text-align:center;
}
.panel .title{margin:0;font-size:clamp(1.6rem, 5vw, 2.1rem);letter-spacing:-0.02em}
.cover-art{width:100%;height:auto;aspect-ratio:16/9;object-fit:cover;border-radius:14px;margin-bottom:12px;display:block}
.panel .tagline{margin:6px 0 0;font-weight:700;color:var(--accent);font-size:1.05rem}
.panel .howto{margin:12px 0 14px;opacity:0.75;font-size:0.92rem}
.cat-picker{display:flex;gap:10px;justify-content:center;flex-wrap:wrap;margin:14px auto 0;max-width:360px}
.cat-option{flex:1 1 150px;max-width:170px;min-height:44px;display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:14px;border:2px solid var(--panel-border);background:white;cursor:pointer;text-align:left;position:relative;transition:border-color 0.15s, box-shadow 0.15s}
.cat-option:hover{border-color:rgba(59,47,53,0.14)}
.cat-option.selected{border-color:var(--accent);box-shadow:0 0 0 3px rgba(255,157,114,0.22);background:#fffaf5}
.cat-option:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
.cat-option-label{display:flex;flex-direction:column;line-height:1.1}
.cat-option-label strong{font-size:0.82rem}
.cat-option-label span{font-size:0.70rem;opacity:0.6}
.cat-option-check{margin-left:auto;width:20px;height:20px;border-radius:50%;background:var(--accent);color:white;display:flex;align-items:center;justify-content:center;font-size:12px;opacity:0;transform:scale(0.7);transition:opacity 0.15s, transform 0.15s}
.cat-option.selected .cat-option-check{opacity:1;transform:scale(1)}
.mini-cat{width:32px;height:32px;border-radius:50% 50% 46% 46% / 58% 58% 42% 42%;position:relative;flex:0 0 32px;overflow:visible;display:flex;align-items:center;justify-content:center}
.mini-cat.grey{background:linear-gradient(180deg,#b8c0c8,#8d959f)}
.mini-cat.ginger{background:linear-gradient(180deg,#F2A45F,#CF7137)}
.mini-body{width:70%;height:70%;position:relative}
.mini-body::before,.mini-body::after{content:"";position:absolute;top:-6px;width:8px;height:9px;background:inherit;filter:brightness(0.95);border-radius:60% 60% 18% 18% / 56% 56% 26% 26%}
.mini-body::before{left:1px;transform:rotate(-9deg)}
.mini-body::after{right:1px;transform:rotate(9deg)}
.mini-cat.grey .mini-body::before,.mini-cat.grey .mini-body::after{background:#9aa3ad}
.mini-cat.ginger .mini-body::before,.mini-cat.ginger .mini-body::after{background:#E8934A}
.dev-badge{margin-top:10px;font-size:0.78rem;font-weight:800;letter-spacing:0.04em;text-transform:uppercase;color:#b55a2a;background:rgba(255,157,114,0.18);padding:6px 10px;border-radius:999px;display:inline-block}
.dev-badge.hidden{display:none}
.panel h2{margin:0 0 8px;font-size:1.35rem}
.panel p{margin:6px 0}

/* Step 06 — briefing, challenge HUD, combo strip */
#hud-timer.urgent{color:#fff;background:#c0392b;border-radius:10px;padding:0 8px;animation:timerPulse 1s ease-in-out infinite}
@keyframes timerPulse{0%,100%{transform:scale(1)}50%{transform:scale(1.08)}}
.tummy-slots{letter-spacing:0.12em;font-size:1rem}
.tummy-slots.bad{color:#c0392b}
#meal-combo-strip{
  margin:6px 10px 0;padding:8px 12px;
  background:var(--panel);border:1px solid var(--panel-border);border-radius:14px;
  box-shadow:var(--shadow);
  display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:center;
  font-size:0.86rem;font-weight:700;
}
#meal-combo-strip .combo-step{display:inline-flex;align-items:center;gap:6px;padding:4px 8px;border-radius:999px;border:1px solid var(--panel-border);background:#fff;min-height:44px}
#meal-combo-strip .combo-step.done{background:#e6f4d8;border-color:#7fb069}
#meal-combo-strip .combo-step.next{background:#fff7e0;border-color:#d9a441}
#meal-combo-strip .combo-step img{width:28px;height:28px;object-fit:contain;border-radius:8px}
#meal-combo-strip .combo-arrow{opacity:0.5}
.panel.briefing{text-align:left}
.panel.briefing h2{margin:0;font-size:1.3rem;text-align:center}
.brief-level{margin:4px 0 10px;text-align:center;font-weight:800;color:var(--accent)}
.brief-rows{margin:0 0 10px;display:flex;flex-direction:column;gap:6px}
.brief-rows div{display:flex;gap:10px;align-items:baseline}
.brief-rows dt{flex:0 0 74px;font-size:0.72rem;font-weight:800;letter-spacing:0.05em;opacity:0.6}
.brief-rows dd{margin:0;font-weight:700;font-size:0.92rem}
.brief-thumbs{display:flex;gap:8px;justify-content:center;margin:4px 0 12px;flex-wrap:wrap}
.brief-thumbs img{width:44px;height:44px;object-fit:contain;border-radius:10px;background:#fff8f0;border:1px solid var(--panel-border)}
.brief-thumbs .combo-more{display:inline-flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;padding:0 10px;border-radius:10px;background:#fff8f0;border:1px solid var(--panel-border);font-weight:800;font-size:0.82rem}
#brief-allowed{display:flex;gap:6px;flex-wrap:wrap;align-items:center}
#brief-allowed .can-eat-icon{width:38px;height:38px;object-fit:contain;border-radius:10px;background:#fff8f0;border:1px solid var(--panel-border)}
.panel.briefing .btn{min-height:44px;width:100%}
#win-overlay .panel .btn,#lose-overlay .panel .btn{min-height:44px;margin-top:8px;width:100%}
.float-label.good{color:#2e7d32}
.float-label.warn{color:#b7791f}
.float-label.bad{color:#c0392b}
#cat-wrap.grimace{animation:grimaceShake 0.4s ease}
@keyframes grimaceShake{0%,100%{transform:translateX(0)}25%{transform:translateX(-7px) rotate(-1deg)}75%{transform:translateX(7px) rotate(1deg)}}
@media (max-width: 560px){
  .hud-left,.hud-right{gap:8px}
  .hud-label{font-size:0.6rem}
  .hud-value{font-size:0.9rem}
  #meal-combo-strip{font-size:0.78rem;margin:6px 8px 0}
  #meal-combo-strip .combo-step{min-height:44px}
}
@media (max-height: 500px) and (orientation: landscape){
  #meal-combo-strip{padding:4px 8px}
  #meal-combo-strip .combo-step img{width:22px;height:22px}
}

/* Accessibility */
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.hidden{display:none !important}

/* Responsive — 6 viewport classes */
@media (max-width: 380px){
  #hud{padding:8px 10px;gap:6px}
  .hud-value{font-size:0.98rem}
  #food-lane{margin:0 8px;padding:8px 6px 10px}
  .food-item{width:64px;height:64px}
  #cat-wrap{width:min(84vw, 380px)}
}
@media (min-width: 768px){
  #hud{margin:12px 16px 0;padding:12px 18px}
  .hud-value{font-size:1.15rem}
  #cat-wrap{width:min(52vw, 560px)}
  #food-lane{margin:0 16px;min-height:104px}
  .food-item{width:78px;height:78px}
}
@media (min-width: 1100px){
  #cat-wrap{width:min(42vw, 620px)}
  #food-lane{margin:0 24px}
}
@media (max-height: 500px) and (orientation: landscape){
  #hud{padding:6px 12px;margin-top:6px}
  #cat-stage{padding:6px}
  #cat-wrap{width:min(38vh, 360px)}
  #food-lane{min-height:84px;padding:6px}
  #controls{padding:6px}
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  .float-label{animation:none;opacity:1}
  .food-item{transition:none}
}

/* Visible DEV TOOLS button — testing build */
#btn-dev-tools{
  position:fixed;
  left:calc(10px + env(safe-area-inset-left, 0px));
  bottom:calc(10px + env(safe-area-inset-bottom, 0px));
  z-index:9;
  appearance:none;
  border:1px solid rgba(59,47,53,0.12);
  background:rgba(255,255,255,0.96);
  color:var(--text);
  font-weight:800;
  font-size:0.78rem;
  letter-spacing:0.06em;
  padding:0 14px;
  min-width:44px;
  min-height:44px;
  border-radius:999px;
  box-shadow:0 4px 16px rgba(59,47,53,0.18);
  backdrop-filter:blur(8px);
  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
}
#btn-dev-tools.hidden{display:none !important}
#btn-dev-tools:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
#btn-dev-tools:active{transform:scale(0.97)}
/* Keep button clear of food lane and controls — lane has margin 0 10px, button sits in safe corner */
@media (max-height: 500px) and (orientation: landscape){
  #btn-dev-tools{bottom:calc(6px + env(safe-area-inset-bottom, 0px)); left:calc(6px + env(safe-area-inset-left, 0px))}
}

/* Dev tool — desktop two-column, phone stacked */
#dev-root{
  position:fixed;inset:0;z-index:20;
  background:rgba(255,250,245,0.98);
  overflow:auto;
  padding:14px;
  padding-top:calc(14px + var(--safe-top));
  padding-bottom:calc(14px + var(--safe-bottom));
}
#dev-root.hidden{display:none}
.dev-header{display:flex;flex-wrap:wrap;gap:10px;align-items:center;justify-content:space-between;margin-bottom:12px}
.dev-header h2{margin:0;font-size:1.2rem}
.dev-tabs{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:12px}
.dev-tab{padding:8px 12px;border-radius:999px;border:1px solid var(--panel-border);background:white;cursor:pointer;font-weight:700;font-size:0.84rem;min-height:40px}
.dev-tab.active{background:var(--accent);color:white;border-color:transparent}
.dev-layout{display:grid;grid-template-columns:280px 1fr;gap:14px;align-items:start}
@media (max-width: 860px){ .dev-layout{grid-template-columns:1fr} }
.dev-list{border:1px solid var(--panel-border);border-radius:14px;background:white;overflow:hidden}
.dev-list-head{padding:10px 12px;border-bottom:1px solid var(--panel-border);display:flex;gap:8px;align-items:center}
.dev-list-head input{flex:1;padding:8px 10px;border-radius:10px;border:1px solid #e8ddd6;font-size:0.9rem;min-height:40px}
.dev-list-items{max-height:52vh;overflow:auto}
.dev-list-item{padding:10px 12px;border-bottom:1px solid #f0e6df;display:flex;gap:10px;align-items:center;cursor:pointer}
.dev-list-item:hover{background:#fff6ee}
.dev-list-item.active{background:rgba(255,157,114,0.16)}
.dev-list-item img{width:44px;height:44px;object-fit:contain;border-radius:10px;background:#fff8f0;border:1px solid #f0e6df;flex:0 0 44px}
.dev-editor{border:1px solid var(--panel-border);border-radius:14px;background:white;padding:14px}
.dev-editor h3{margin:0 0 10px;font-size:1rem}
.field{display:flex;flex-direction:column;gap:4px;margin-bottom:10px}
.field label{font-size:0.8rem;font-weight:700;opacity:0.7}
.field input,.field select{padding:9px 10px;border-radius:10px;border:1px solid #e8ddd6;font-size:0.92rem;min-height:42px;background:white}
.field .hint{font-size:0.76rem;opacity:0.6}
.field.row{flex-direction:row;align-items:center;gap:8px}
.preview-box{border:1px dashed #e8ddd6;border-radius:12px;padding:10px;background:#fffaf5;min-height:120px;display:flex;align-items:center;justify-content:center;overflow:hidden;position:relative}
.preview-box img{max-width:100%;max-height:220px;object-fit:contain}
.bg-previews{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:8px}
@media (max-width: 600px){ .bg-previews{grid-template-columns:1fr} }
.bg-preview{border:1px solid #e8ddd6;border-radius:10px;overflow:hidden;aspect-ratio:16/9;position:relative;background:#fff6ee}
.bg-preview img{width:100%;height:100%;object-fit:cover}
.bg-preview span{position:absolute;left:6px;bottom:4px;background:rgba(0,0,0,0.55);color:white;font-size:0.68rem;padding:2px 6px;border-radius:999px}
.focal-picker{width:100%;height:160px;border:1px solid #e8ddd6;border-radius:10px;position:relative;overflow:hidden;background:#ddd;cursor:crosshair}
.focal-picker img{width:100%;height:100%;object-fit:cover}
.focal-dot{position:absolute;width:14px;height:14px;border:2px solid white;border-radius:50%;background:var(--accent);box-shadow:0 1px 6px rgba(0,0,0,0.4);transform:translate(-50%,-50%);pointer-events:none}
.warn{color:#b5472a;font-size:0.8rem;font-weight:700}
.sticky-actions{position:sticky;bottom:0;background:white;padding:10px 0 2px;display:flex;gap:8px;flex-wrap:wrap;border-top:1px solid #f0e6df;margin-top:10px}
