/* Meal Builders kit: shared styles. Sites theme it with these variables:
   --ink --paper --accent --accent-ink --font-display --font-body --font-mono --radius */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-body, system-ui, sans-serif);
  color: var(--ink, #111);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}
img { display: block; max-width: none; user-select: none; -webkit-user-drag: none; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus, #2f6bff); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- stage ---------- */
.kc-viewport {
  position: fixed; inset: 0;
  overflow: hidden;
  overflow: clip; /* hidden still allows programmatic scroll of the bleeding backdrop */
}
.kc-stage {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(var(--s, 1));
  transform-origin: 50% 50%;
}
.kc-scene { position: absolute; inset: 0; transform-style: preserve-3d; will-change: transform; }
html.is-portrait body { overflow-y: auto; overflow-x: hidden; }
html.is-portrait .kc-viewport { position: absolute; inset: 0 0 auto 0; height: var(--stage-h); }
html.is-portrait .kc-stage { left: 0; top: 0; transform: scale(var(--s, 1)); transform-origin: 0 0; }

/* ---------- custom cursor ---------- */
html.has-kc-cursor, html.has-kc-cursor * { cursor: none !important; }
html.has-kc-cursor .kc-modal, html.has-kc-cursor .kc-modal * { cursor: auto !important; }
html.has-kc-cursor .kc-modal button, html.has-kc-cursor .kc-modal summary { cursor: pointer !important; }
.kc-cursor {
  position: fixed; left: 0; top: 0; z-index: 2000;
  pointer-events: none; opacity: 0;
  transition: opacity .2s;
  will-change: transform;
}
.kc-cursor.is-on { opacity: 1; }
.kc-cursor.is-away, html:has(.kc-modal.is-in) .kc-cursor { opacity: 0; }
.kc-cursor img {
  width: 100%; height: auto;
  transform: translate(var(--hx), var(--hy)) rotate(var(--rot));
  transform-origin: calc(var(--hx) * -1) calc(var(--hy) * -1);
  filter: drop-shadow(10px 16px 10px rgba(0,0,0,.35));
  transition: transform .18s cubic-bezier(.3,.7,.4,1.4), filter .18s;
}
.kc-cursor.is-hover img { transform: translate(var(--hx), var(--hy)) rotate(calc(var(--rot) - 6deg)) scale(1.06); filter: drop-shadow(16px 24px 14px rgba(0,0,0,.3)); }
.kc-cursor.is-pinch img { animation: kc-pinch .28s ease; }
@keyframes kc-pinch { 40% { transform: translate(var(--hx), var(--hy)) rotate(calc(var(--rot) + 8deg)) scale(.92); } }

/* ---------- flights and particles ---------- */
.kc-fly { position: fixed; left: 0; top: 0; pointer-events: none; will-change: transform; }
.kc-fly img { width: 100%; height: 100%; object-fit: contain; }
.kc-fly.has-shadow > img { filter: drop-shadow(0 calc(10px + var(--lift, 0) * 260px) calc(8px + var(--lift, 0) * 120px) rgba(0,0,0,.35)); }
.kc-fly-tool { position: absolute; right: 18%; top: 22%; }
.kc-fly-tool img { width: 100%; height: auto; transform: translate(var(--hx), var(--hy)); filter: drop-shadow(10px 16px 10px rgba(0,0,0,.35)); }
.kc-bit { position: fixed; z-index: 1500; pointer-events: none; border-radius: 50%; }
.kc-bit.square { border-radius: 2px; }
.kc-bit.strip { border-radius: 2px; }
.kc-steam {
  position: absolute; bottom: 20%; width: 46%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, var(--c) 0%, transparent 62%);
  filter: blur(10px); pointer-events: none; mix-blend-mode: screen;
}

/* ---------- receipt ---------- */
.kc-receipt {
  --rc-ink: #1d1d1b;
  position: relative;
  background: #fbfaf6;
  color: var(--rc-ink);
  font-family: var(--font-mono, ui-monospace, Menlo, monospace);
  font-size: 13px;
  line-height: 1.35;
  padding: 26px 22px 30px;
  box-shadow: 0 30px 50px -20px rgba(0,0,0,.45), 0 2px 0 rgba(0,0,0,.05);
  background-image:
    linear-gradient(transparent 0 0),
    repeating-linear-gradient(0deg, rgba(0,0,0,.018) 0 1px, transparent 1px 3px);
}
.kc-receipt::before, .kc-receipt::after {
  content: ''; position: absolute; left: 0; right: 0; height: 10px;
  background: linear-gradient(-45deg, transparent 6px, #fbfaf6 6px) 0 0 / 12px 10px repeat-x,
              linear-gradient(45deg, transparent 6px, #fbfaf6 6px) 0 0 / 12px 10px repeat-x;
}
.kc-receipt::before { top: -9px; transform: scaleY(-1); }
.kc-receipt::after { bottom: -9px; }
.rc-head { text-align: center; border-bottom: 1px dashed rgba(0,0,0,.35); padding-bottom: 12px; margin-bottom: 12px; }
.rc-brand { font-family: var(--font-display); font-size: 30px; line-height: .86; letter-spacing: -.01em; text-transform: uppercase; }
.rc-sub { margin-top: 8px; font-weight: 700; letter-spacing: .14em; font-size: 11px; text-transform: uppercase; }
.rc-meta { display: flex; justify-content: space-between; margin-top: 10px; font-size: 10.5px; opacity: .6; }
.rc-lines { list-style: none; margin: 0; padding: 0; }
.rc-lines li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; transition: opacity .3s; }
.rc-lines li.is-empty { opacity: .35; }
.rc-lines li.is-flash { animation: rc-flash .9s ease; }
@keyframes rc-flash { 0% { background: var(--accent, #ffd60a); transform: translateX(-4px); } 100% { background: transparent; transform: none; } }
.rc-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-v { flex: none; }
.rc-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px dashed rgba(0,0,0,.35); margin-top: 12px; padding-top: 10px; font-weight: 700; text-transform: uppercase; }
.rc-total strong { font-size: 22px; }
.rc-barcode { margin: 14px 0 6px; text-align: center; }
.rc-barcode svg { width: 100%; height: 38px; fill: var(--rc-ink); }
.rc-barcode span { font-size: 9px; letter-spacing: .1em; opacity: .7; }
.rc-cta {
  display: block; width: 100%; margin-top: 14px; padding: 12px 10px;
  border: 1.5px solid var(--rc-ink); background: transparent; border-radius: 4px;
  font-family: var(--font-mono); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; font-size: 12px;
  transition: background .25s, color .25s, transform .2s;
}
.rc-cta:disabled { opacity: .35; cursor: not-allowed; }
.kc-receipt.is-ready .rc-cta { background: var(--accent, #ffd60a); color: var(--accent-ink, #111); border-color: var(--accent-ink, #111); animation: rc-nudge 1.6s ease-in-out infinite; }
.kc-receipt.is-ready .rc-cta:hover { transform: translateY(-2px); }
@keyframes rc-nudge { 50% { box-shadow: 0 0 0 6px rgba(0,0,0,.08); } }
.rc-hint { font-size: 10.5px; text-align: center; opacity: .55; margin-top: 8px; }
.rc-foot { text-align: center; font-size: 10px; letter-spacing: .2em; text-transform: uppercase; opacity: .45; margin-top: 14px; }

/* ---------- status pill ---------- */
.kc-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 999px;
  background: var(--pill-bg, #1d1d1b); color: var(--pill-ink, #fff);
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.kc-pill.is-in { animation: kc-pill .45s cubic-bezier(.3,.7,.4,1.4); }
@keyframes kc-pill { from { transform: translateY(10px) scale(.9); opacity: 0; } }

/* ---------- sound toggle ---------- */
.kc-sound {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; background: rgba(0,0,0,.72); color: #fff;
  padding: 8px 14px 8px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .04em;
  backdrop-filter: blur(6px);
}
.kc-sound .kc-eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.kc-sound .kc-eq i { width: 3px; height: 4px; background: currentColor; border-radius: 1px; }
html.sound-on .kc-sound .kc-eq i { animation: kc-eq .9s ease-in-out infinite; }
html.sound-on .kc-sound .kc-eq i:nth-child(2) { animation-delay: -.3s; }
html.sound-on .kc-sound .kc-eq i:nth-child(3) { animation-delay: -.6s; }
@keyframes kc-eq { 50% { height: 12px; } }

/* ---------- modal ---------- */
.kc-modal {
  position: fixed; inset: 0; z-index: 1800;
  display: grid; place-items: center; padding: 16px;
  background: rgba(10,10,10,.45); backdrop-filter: blur(4px);
  opacity: 0; transition: opacity .35s;
}
.kc-modal.is-in { opacity: 1; }
.kc-sheet {
  position: relative; width: min(440px, 100%); max-height: calc(100dvh - 32px); overflow: auto;
  background: var(--sheet-bg, #fff); color: var(--sheet-ink, #111);
  border-radius: var(--sheet-radius, 18px); padding: 28px 26px 24px;
  box-shadow: 0 40px 80px -20px rgba(0,0,0,.5);
  transform: translateY(30px) rotate(-1.5deg) scale(.96); transition: transform .5s cubic-bezier(.3,.7,.3,1.2);
  font-family: var(--font-body);
}
.kc-modal.is-in .kc-sheet { transform: none; }
.kc-sheet h2 { font-family: var(--font-display); font-size: 38px; line-height: .95; margin: 0 0 6px; text-transform: var(--sheet-case, uppercase); letter-spacing: -.01em; }
.kc-msub { margin: 0 0 16px; opacity: .7; font-size: 14px; line-height: 1.45; }
.kc-x { position: absolute; right: 14px; top: 12px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(0,0,0,.06); font-size: 22px; line-height: 1; }
.kc-segs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; background: rgba(0,0,0,.06); border-radius: 12px; margin: 14px 0 12px; }
.kc-seg { border: 0; background: transparent; padding: 9px; border-radius: 9px; font-weight: 700; font-size: 14px; transition: background .2s; }
.kc-seg.is-on { background: var(--sheet-bg, #fff); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.kc-field { display: block; margin-bottom: 10px; }
.kc-field[hidden] { display: none; }
.kc-field span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; opacity: .6; margin-bottom: 5px; }
.kc-field input, .kc-field select {
  width: 100%; padding: 12px 13px; border-radius: 10px; border: 1.5px solid rgba(0,0,0,.15);
  font: inherit; font-size: 15px; background: #fff; color: #111;
}
.kc-field input:focus, .kc-field select:focus { outline: none; border-color: var(--accent-strong, #2f6bff); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-strong, #2f6bff) 25%, transparent); }
.kc-field.is-bad input { border-color: #e5383b; background: #fff5f5; }
.kc-sum { margin: 12px 0 16px; font-size: 13px; border-top: 1px dashed rgba(0,0,0,.2); padding-top: 10px; }
.kc-sum summary { display: flex; justify-content: space-between; list-style: none; cursor: pointer; font-weight: 700; }
.kc-sum summary::-webkit-details-marker { display: none; }
.kc-sum ul { list-style: none; padding: 0; margin: 8px 0 0; }
.kc-sum li { display: flex; justify-content: space-between; padding: 2px 0; opacity: .75; }
.kc-place {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  padding: 15px 18px; border: 0; border-radius: 12px;
  background: var(--accent-strong, #111); color: var(--accent-strong-ink, #fff);
  font-weight: 800; font-size: 16px; letter-spacing: .02em;
  transition: transform .2s, box-shadow .2s;
}
.kc-place:hover { transform: translateY(-2px); box-shadow: 0 10px 20px -8px rgba(0,0,0,.4); }
.kc-sheet.is-done { text-align: center; }
.kc-sheet.is-done .kc-place { justify-content: center; margin-top: 18px; }
.kc-tick svg { width: 76px; height: 76px; margin: 6px auto 14px; display: block; fill: none; stroke: var(--accent-strong, #111); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.kc-tick circle { stroke-dasharray: 151; stroke-dashoffset: 151; animation: kc-draw .7s ease forwards; }
.kc-tick path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: kc-draw .4s .6s ease forwards; }
@keyframes kc-draw { to { stroke-dashoffset: 0; } }

/* ---------- intro gate ---------- */
.kc-intro {
  position: fixed; inset: 0; z-index: 1700;
  display: grid; place-items: center; text-align: center;
  transition: opacity .8s ease, visibility .8s;
}
.kc-intro.is-gone { opacity: 0; visibility: hidden; pointer-events: none; }
.kc-intro [data-progress] { --p: 0; width: 180px; height: 3px; margin: 18px auto 0; background: rgba(255,255,255,.2); border-radius: 3px; overflow: hidden; }
.kc-intro [data-progress]::after { content: ''; display: block; height: 100%; width: calc(var(--p) * 100%); background: currentColor; transition: width .2s; }
.kc-intro.is-loaded [data-progress] { opacity: 0; transition: opacity .4s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
