/* --- Cocina a dos --- */
.cocina { --floor: #edd4a8; }
.cocina canvas.ico { display: block; image-rendering: crisp-edges; image-rendering: pixelated; flex: none; }

/* HUD: riel de pedidos + chips */
.ck-hud { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px 18px; margin: 0 auto 16px; flex-wrap: wrap; }
.ck-rail {
  flex: 1 1 520px; min-height: 132px; position: relative; padding: 14px 12px 10px;
  background: repeating-linear-gradient(90deg, #0000 0 22px, #1f1a170d 22px 24px), var(--paper-2);
  border: var(--stroke); border-radius: var(--r-sm); box-shadow: inset 0 6px 0 #1f1a1714;
}
.ck-rail::before { /* la barrita de donde cuelgan los tickets */
  content: ''; position: absolute; left: 10px; right: 10px; top: 6px; height: 6px; border-radius: 4px;
  background: #b9c2cf; border: 2px solid var(--ink);
}
.ck-orders { display: flex; gap: 12px; align-items: flex-start; min-height: 104px; }
.ck-ticket {
  position: relative; width: 128px; flex: none; padding: 8px 8px 9px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--sheet); border: var(--stroke); border-radius: 6px 6px 10px 10px; box-shadow: var(--shadow);
  transform: rotate(var(--tilt, 0deg)); transform-origin: 50% 0;
  animation: ck-drop .55s var(--ease-pop) both;
}
.ck-ticket::before { /* chinche */
  content: ''; position: absolute; top: -9px; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%;
  background: var(--tomato); border: 2px solid var(--ink);
}
.ck-ticket .nm { font-family: var(--pixel); font-size: .88rem; line-height: 1.05; text-align: center; min-height: 1.9em; display: grid; place-items: center; }
.ck-ticket .parts { display: flex; gap: 2px; justify-content: center; }
.ck-ticket .bar { width: 100%; height: 9px; border: 2px solid var(--ink); border-radius: 6px; background: #f1e6d4; overflow: hidden; }
.ck-ticket .bar i { display: block; height: 100%; background: var(--mint); transition: width .2s linear, background .3s; }
.ck-ticket.warn .bar i { background: var(--sun); }
.ck-ticket.urgent { background: #ffe1d8; animation: ck-wiggle .5s ease-in-out infinite; }
.ck-ticket.urgent .bar i { background: var(--tomato); }
.ck-ticket.served { animation: ck-served .7s var(--ease-pop) forwards; }
.ck-ticket.served::after, .ck-ticket.expired::after {
  position: absolute; inset: 30% 6px auto; padding: 2px 0; text-align: center; font-family: var(--pixel); font-size: 1.2rem;
  border: 3px solid currentColor; border-radius: 6px; transform: rotate(-12deg); background: #fffdf7dd;
}
.ck-ticket.served::after { content: '✓'; color: #13945c; }
.ck-ticket.expired { animation: ck-expired .7s ease-in forwards; background: #ffd0c4; }
.ck-ticket.expired::after { content: '✗'; color: var(--tomato); }
@keyframes ck-drop { from { transform: translateY(-40px) rotate(-14deg); opacity: 0; } }
@keyframes ck-wiggle { 50% { transform: rotate(calc(var(--tilt, 0deg) + 3deg)); } }
@keyframes ck-served { 30% { transform: scale(1.1) rotate(-3deg); } to { transform: translateY(-30px) scale(.8); opacity: 0; } }
@keyframes ck-expired { 20% { transform: rotate(8deg); } to { transform: translateY(60px) rotate(24deg); opacity: 0; } }

.ck-side { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.cocina .ck-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 14px 4px 8px; min-height: 42px;
  font-family: var(--pixel); font-size: 1.3rem; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap;
  background: var(--sheet); border: var(--stroke); border-radius: 10px; box-shadow: var(--shadow);
}
.cocina .ck-chip.lvl { background: var(--sun); transform: rotate(-1.5deg); font-size: 1.1rem; }
.cocina .ck-chip.coin { background: #fff0b8; transform: rotate(1deg); font-size: 1.6rem; }
.cocina .ck-chip.time { background: #d6f5e7; }
.cocina .ck-chip.time.hurry { background: var(--tomato); color: #fff; animation: nudge .6s infinite; }
.cocina .ck-chip.bump { animation: ck-bump .45s var(--ease-pop); }
.cocina .ck-chip.shake { animation: ck-shake .4s; }
@keyframes ck-bump { 40% { transform: scale(1.22) rotate(-4deg); } }
@keyframes ck-shake { 25% { translate: -5px 0; } 50% { translate: 5px 0; } 75% { translate: -3px 0; } }

/* escenario: sticker con cinta, como Chispa y Gota */
.cocina .stage { display: flex; justify-content: center; }
.cocina .frame {
  position: relative; line-height: 0; background: var(--floor);
  border: 4px solid var(--ink); border-radius: 8px; box-shadow: var(--shadow-lg);
}
.cocina .frame::before, .cocina .frame::after {
  content: ''; position: absolute; top: -14px; width: 92px; height: 26px; z-index: 2; pointer-events: none;
  background: #ffe28acc; border-left: 2px dashed #0002; border-right: 2px dashed #0002;
}
.cocina .frame::before { left: -24px; transform: rotate(-24deg); }
.cocina .frame::after { right: -24px; transform: rotate(22deg); background: #c9f5dfcc; }
.cocina canvas.view { display: block; width: 100%; border-radius: 4px; image-rendering: crisp-edges; image-rendering: pixelated; }

.cocina .banner {
  position: absolute; left: 50%; top: 42%; z-index: 3; pointer-events: none; white-space: nowrap;
  font-family: var(--pixel); font-size: clamp(1.6rem, 4vw, 3rem); line-height: 1.1;
  padding: 10px 28px 12px; border: 4px solid var(--ink); border-radius: 10px; box-shadow: 6px 6px 0 var(--ink);
  transform: translate(-50%, -50%) rotate(-3deg); animation: ck-pop .45s var(--ease-pop) both;
  background: var(--sheet); color: var(--ink);
}
.cocina .banner.count { font-size: clamp(2.6rem, 7vw, 4.6rem); padding: 4px 30px 8px; background: var(--sun); }
.cocina .banner.go { background: var(--mint); }
.cocina .banner.over { background: var(--tomato); color: #fff; transform: translate(-50%, -50%) rotate(2deg); }
.cocina .banner[hidden] { display: none; }
@keyframes ck-pop { from { transform: translate(-50%, -50%) scale(.4) rotate(-12deg); opacity: 0; } }

.ck-duo { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin: 18px auto 0; }
.cocina .ck-tag { display: inline-flex; align-items: center; gap: 8px; padding: 3px 14px 3px 6px; min-height: 46px; border: var(--stroke); border-radius: 10px; box-shadow: var(--shadow); }
.cocina .ck-tag.red { background: #ffd0c4; transform: rotate(-1deg); }
.cocina .ck-tag.blue { background: #cdd9ff; transform: rotate(1deg); }
.cocina .ck-tag small { display: block; font-family: var(--pixel); font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; line-height: 1; color: var(--ink-soft); }
.cocina .ck-tag b { display: block; max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.15; }
.cocina .ck-tag.me { outline: 3px dashed var(--ink); outline-offset: 3px; }

/* ayuda + recetario */
.cocina .help { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px 22px; margin: 20px auto 0; max-width: 980px; text-align: center; }
.cocina .role { display: inline-flex; align-items: center; gap: 8px; padding: 4px 14px 4px 6px; min-height: 44px; font-weight: 800; background: var(--sheet); border: var(--stroke); border-radius: 10px; box-shadow: var(--shadow); }
.cocina .role.red { background: #ffd0c4; }
.cocina .role.blue { background: #cdd9ff; }
.cocina .role.spec { padding-left: 14px; }
.cocina .keys { display: inline-flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 5px; font-weight: 700; }
.cocina .keys em { font-style: normal; color: var(--ink-soft); margin: 0 6px; }
.cocina .keys small { color: var(--ink-soft); font-weight: 600; }
.cocina kbd {
  display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 7px;
  font-family: var(--pixel); font-size: 1rem; line-height: 1;
  background: var(--sheet); border: 2px solid var(--ink); border-bottom-width: 5px; border-radius: 7px;
}
.cocina kbd.wide { min-width: 76px; }
.cocina .hint { flex-basis: 100%; color: var(--ink-soft); font-size: .98rem; font-weight: 600; }
.ck-book { flex-basis: 100%; }
.ck-book h3 { margin: 6px 0 10px; }
#book { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.ck-recipe {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px;
  background: var(--sheet); border: var(--stroke); border-radius: 10px; box-shadow: 3px 3px 0 var(--ink);
}
.ck-recipe:nth-child(odd) { transform: rotate(-1deg); } .ck-recipe:nth-child(even) { transform: rotate(1deg); }
.ck-recipe .nm { font-family: var(--pixel); font-size: 1rem; }
.ck-recipe .parts { display: flex; align-items: center; gap: 4px; }
.ck-recipe .parts b { font-family: var(--pixel); color: var(--ink-soft); }
.ck-recipe .chain { display: inline-flex; align-items: center; gap: 1px; padding: 1px 3px; background: var(--paper-2); border-radius: 6px; }
.ck-recipe .chain .tool { opacity: .85; transform: scale(.8); }

/* fin */
.ck-end { max-width: 460px; }
.ck-kicker { font-family: var(--pixel); color: var(--ink-soft); margin: 0 0 6px; }
.ck-stars { display: flex; justify-content: center; gap: 14px; margin: 8px 0 4px; }
.ck-stars canvas { animation: ck-star .6s var(--ease-pop) both; animation-delay: var(--d); }
.ck-stars canvas:nth-child(2) { translate: 0 -10px; }
@keyframes ck-star { from { transform: scale(0) rotate(-90deg); opacity: 0; } }
.ck-rating { font-family: var(--display); font-size: 1.4rem; margin: 4px 0 14px; }
.ck-stats { list-style: none; padding: 0; margin: 0 auto 20px; display: grid; gap: 6px; max-width: 320px; text-align: left; font-weight: 700; }
.ck-stats li { display: flex; align-items: center; gap: 10px; padding: 4px 10px; background: var(--paper); border: 2px solid var(--ink); border-radius: 8px; }
.ck-stats b { margin-left: auto; font-family: var(--pixel); font-size: 1.25rem; font-weight: 400; }
.ck-end .row { justify-content: center; flex-wrap: wrap; }
.ck-confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 41; }
.ck-confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border: 2px solid var(--ink); border-radius: 2px; animation: ck-fall linear both; }
@keyframes ck-fall { to { transform: translate(var(--dx), 110vh) rotate(var(--r)); } }

@media (max-width: 860px) {
  .ck-side { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .ck-hud { justify-content: center; }
  .cocina .frame::before, .cocina .frame::after { display: none; }
  .ck-ticket { width: 112px; }
}
@media (prefers-reduced-motion: reduce) {
  .ck-confetti { display: none; }
}

/* --- controles táctiles (tablet) --- */
.cocina .tc-toggle { padding: 6px 12px; font-size: .85rem; box-shadow: 2px 2px 0 var(--ink); }
.cocina .tc-toggle[aria-pressed="true"] { background: var(--sun); }
.cocina.spec .tc-toggle, .cocina.spec .tpad { display: none !important; }
.cocina.touch { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.cocina.touch .stage { max-width: none; } /* la regla global de .stage (pintar) achica de más en tablet */
.cocina.touch .stage, .cocina.touch canvas.view { touch-action: none; }
.cocina.touch .help .keys { display: none; }
/* HUD más bajito para que la cocina entre en la tablet: las fichas en dos filas al lado del riel */
.cocina.touch .ck-side { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-end; max-width: 330px; }
.cocina .tpad { display: none; }
.cocina.touch .tpad {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 16px auto 0; max-width: 980px;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
/* horizontal: joystick abajo a la izquierda, botones abajo a la derecha */
.cocina.touch.land .tpad {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; margin: 0; max-width: none; pointer-events: none;
  padding: 0 max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.cocina.touch.land .tpad > * { pointer-events: auto; }
.cocina .tp-stick {
  position: relative; width: 156px; height: 156px; flex: none; border-radius: 50%; touch-action: none;
  background:
    radial-gradient(circle, #0000 0 38%, #1f1a1714 38% 39%, #0000 39%),
    color-mix(in srgb, var(--sheet) 78%, transparent);
  border: var(--stroke); box-shadow: var(--shadow);
}
.cocina .tp-stick::before { /* crucecita de guía */
  content: ''; position: absolute; inset: 14px; border-radius: 50%; pointer-events: none;
  background: linear-gradient(var(--ink), var(--ink)) 50% 0 / 4px 12px no-repeat, linear-gradient(var(--ink), var(--ink)) 50% 100% / 4px 12px no-repeat,
              linear-gradient(var(--ink), var(--ink)) 0 50% / 12px 4px no-repeat, linear-gradient(var(--ink), var(--ink)) 100% 50% / 12px 4px no-repeat;
  opacity: .35;
}
.cocina .tp-knob {
  position: absolute; left: 50%; top: 50%; width: 70px; height: 70px; margin: -35px 0 0 -35px; border-radius: 50%; pointer-events: none;
  background: var(--tomato); border: var(--stroke); box-shadow: 3px 3px 0 var(--ink), inset 6px 6px 0 #ffffff66;
  transition: transform .12s var(--ease-pop);
}
.cocina .tp-stick.blue .tp-knob { background: var(--cobalt); }
.cocina .tp-stick.on .tp-knob { transition: none; }
.cocina .tp-acts { display: flex; align-items: flex-end; gap: 14px; }
.cocina .tp-btn {
  display: grid; place-items: center; align-content: center; gap: 1px; border-radius: 50%; touch-action: none; text-align: center;
  font-size: 1.7rem; line-height: 1; border: var(--stroke); box-shadow: var(--shadow);
  transition: transform .08s, box-shadow .08s;
}
.cocina .tp-btn b, .cocina .tp-btn small { font-family: var(--pixel); font-weight: 400; line-height: 1.05; pointer-events: none; }
.cocina .tp-btn b { font-size: .88rem; max-width: 96px; }
.cocina .tp-btn small { font-size: .7rem; opacity: .8; }
.cocina .tp-grab { width: 118px; height: 118px; background: color-mix(in srgb, var(--mint) 88%, transparent); color: var(--ink); transform: rotate(2deg); }
.cocina .tp-chop { width: 90px; height: 90px; margin-bottom: 36px; background: color-mix(in srgb, var(--sun) 88%, transparent); color: var(--ink); transform: rotate(-3deg); }
.cocina .tp-btn.on { box-shadow: 0 0 0 var(--ink); transform: translate(4px, 4px) scale(.96); }
.cocina .tp-grab.on { background: var(--mint); }
.cocina .tp-chop.on { background: var(--sun); }
.cocina .tp-rot {
  display: none; margin: 0 0 10px; padding: 6px 12px; font-weight: 800; font-size: .92rem; text-align: center; max-width: 240px;
  background: var(--sun); border: var(--stroke); border-radius: var(--r-sm); box-shadow: var(--shadow); transform: rotate(-2deg);
}
.cocina.touch:not(.land) .tp-rot { display: block; animation: ck-rot .5s var(--ease-pop) both; }
@keyframes ck-rot { from { transform: scale(.5) rotate(-10deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .cocina .tp-btn, .cocina .tp-knob { transition: none; }
  .cocina.touch:not(.land) .tp-rot { animation: none; }
}
