/* Shawarma Stand. Logical properties, so RTL and LTR share one file. */
:root {
    --bg: #140d10; --surface: #2a1a1f; --surface2: #3d242a; --border: #63363c; --text: #fff6ee; --muted: #e2bfa8;
    --accent: #ffcf3d; --accent2: #ff8a3d; --ok: #49d17d; --bad: #ff5f57; --ink: #2a1208;
    --font: system-ui, "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Sans", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
body { -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
kbd { font: 700 .62rem var(--font); opacity: .55; }

.game { position: relative; max-inline-size: 640px; margin-inline: auto; padding: 8px; }

/* HUD */
.hud { display: flex; align-items: center; gap: 8px; margin-block-end: 8px; }
.stat {
    flex: 1; min-inline-size: 0; display: flex; flex-direction: column; align-items: center;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding-block: 4px;
}
.stat.wide { flex: 1.5; }
.stat .k { font-size: .72rem; color: var(--muted); }
.stat b { font-size: 1.1rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat b.bump { animation: bump .3s ease-out; }
.stat b.low { color: var(--bad); }
@keyframes bump { 40% { transform: scale(1.2); color: var(--accent); } }
.hearts { display: flex; gap: 2px; align-items: center; block-size: 1.4em; }
.hearts svg { inline-size: 17px; block-size: 17px; transition: transform .2s, opacity .2s; }
.hearts svg.lost { opacity: .25; transform: scale(.8); filter: grayscale(1); }
.icon {
    flex: none; inline-size: 44px; block-size: 44px; border-radius: 12px; cursor: pointer; padding: 0;
    background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center;
}
.icon svg { inline-size: 22px; block-size: 22px; }

/* The shop front: an awning, string lights, a neon sign, three counter spots. */
.shop {
    position: relative; border-radius: 16px; overflow: hidden; border: 1px solid var(--border);
    background:
        radial-gradient(ellipse at 50% 125%, rgba(255, 138, 61, .35), transparent 60%),
        radial-gradient(circle at 12% 30%, rgba(255, 220, 120, .12), transparent 18%),
        repeating-linear-gradient(0deg, rgba(0, 0, 0, .12) 0 2px, transparent 2px 26px),
        repeating-linear-gradient(90deg, rgba(0, 0, 0, .08) 0 2px, transparent 2px 52px),
        repeating-linear-gradient(0deg, transparent 0 22px, rgba(0, 0, 0, .1) 22px 24px),
        linear-gradient(#2b4a5a, #1f3a48 60%, #263f4c);
    padding-block: 40px 0; min-block-size: 260px;
}
.awning {
    position: absolute; inset-inline: 0; inset-block-start: 0; block-size: 30px;
    background: repeating-linear-gradient(90deg, #d9342b 0 28px, #ffd23f 28px 56px);
    -webkit-mask: radial-gradient(14px 10px at 14px 30px, transparent 98%, #000) 0 0 / 28px 100% repeat-x;
            mask: radial-gradient(14px 10px at 14px 30px, transparent 98%, #000) 0 0 / 28px 100% repeat-x;
    box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .12);
}
.lights {
    position: absolute; inset-inline: 4%; inset-block-start: 40px; block-size: 22px; display: flex; justify-content: space-between;
    pointer-events: none; border-block-start: 2px solid rgba(0, 0, 0, .35); border-radius: 0 0 50% 50% / 0 0 14px 14px;
}
.lights i { inline-size: 9px; block-size: 12px; margin-block-start: 3px; border-radius: 50% 50% 45% 45%; background: #ffd56a; box-shadow: 0 0 10px #ffc23d; animation: glow 2.4s ease-in-out infinite; }
.lights i:nth-child(2n) { background: #ff8a6a; box-shadow: 0 0 10px #ff6a4a; animation-delay: .6s; }
.lights i:nth-child(3n) { background: #9ff08a; box-shadow: 0 0 10px #6ad85a; animation-delay: 1.2s; }
@keyframes glow { 50% { opacity: .55; } }
.sign { position: absolute; inset-inline: 0; inset-block-start: 78px; display: flex; justify-content: center; pointer-events: none; }
.sign b {
    font-size: 1.6rem; font-weight: 900; letter-spacing: .02em; color: #fff0d6; padding: 5px 18px; border-radius: 999px;
    border: 2px solid rgba(255, 160, 60, .6); background: rgba(255, 160, 60, .06);
    text-shadow: 0 0 10px rgba(255, 160, 60, .9), 0 0 24px rgba(255, 90, 40, .5);
    box-shadow: 0 0 18px rgba(255, 160, 60, .25), inset 0 0 14px rgba(255, 160, 60, .15);
    animation: neon 4s ease-in-out infinite;
}
@keyframes neon { 0%, 100% { opacity: .9; } 48% { opacity: .9; } 50% { opacity: .55; } 52% { opacity: .9; } }
.counter {
    position: relative; z-index: 2; block-size: 22px; margin-block-start: -6px;
    background: linear-gradient(#c9ced6, #8f97a3); border-block-start: 4px solid #eef1f5;
    box-shadow: 0 -2px 0 rgba(0, 0, 0, .2) inset;
}

.slots { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding-inline: 6px; }
.slot {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
    min-block-size: 214px; border: 0; background: none; padding: 0; cursor: pointer; border-radius: 14px;
    touch-action: manipulation;
}
.slot:disabled { cursor: default; }
.slot .who { position: relative; inline-size: 66%; max-inline-size: 92px; margin-block-end: -4px; transition: transform .35s cubic-bezier(.2, .9, .3, 1.3), opacity .3s; }
.slot .cust { display: block; inline-size: 100%; block-size: auto; }
.slot.in .who { animation: walk-in .45s cubic-bezier(.2, .9, .3, 1.2); }
.slot.in .ticket { animation: pop .35s .1s backwards cubic-bezier(.2, .9, .3, 1.3); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.slot.leave .ticket { opacity: 0; transform: scale(.85); }
.slot.leave .who { transform: translateY(30px) scale(.9); opacity: 0; }
.slot.leave.happy .who { transform: translateY(-14px) scale(1.05); opacity: 0; }
@keyframes walk-in { from { transform: translateY(40px) scale(.85); opacity: 0; } }
.slot.match .who { filter: drop-shadow(0 0 10px rgba(73, 209, 125, .9)); }
.slot.shake .who { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px) rotate(-3deg); } 75% { transform: translateX(6px) rotate(3deg); } }

/* Moods: every face is in the SVG, CSS shows one. */
.cust .m { display: none; }
[data-mood="happy"] .cust .m.happy, [data-mood="ok"] .cust .m.ok, [data-mood="meh"] .cust .m.meh, [data-mood="mad"] .cust .m.mad { display: inline; }
[data-mood="mad"] .cust .b-l { transform: rotate(24deg); transform-origin: 40px 39px; }
[data-mood="mad"] .cust .b-r { transform: rotate(-24deg); transform-origin: 60px 39px; }
[data-mood="meh"] .cust .b-l { transform: rotate(12deg); transform-origin: 40px 39px; }
[data-mood="meh"] .cust .b-r { transform: rotate(-12deg); transform-origin: 60px 39px; }
[data-mood="mad"] .who { animation: fume 0.6s ease-in-out infinite; }
@keyframes fume { 50% { transform: translateY(-2px); } }
.vip-star { animation: spin 3s linear infinite; transform-origin: 50px 20px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Order ticket: the sandwich drawn open, and one chip per item. */
.ticket {
    position: relative; inline-size: 100%; max-inline-size: 132px; margin-block-end: 6px; padding: 5px 4px 7px;
    background: #fffaf2; color: var(--ink); border-radius: 10px; box-shadow: 0 4px 0 rgba(0, 0, 0, .25);
    transition: transform .2s, box-shadow .2s;
}
.ticket::after {
    content: ""; position: absolute; inset-inline-start: calc(50% - 7px); inset-block-end: -7px;
    border: 7px solid transparent; border-block-end: 0; border-block-start-color: #fffaf2;
}
.ticket.vip { background: #fff3c4; box-shadow: 0 0 0 2px #ffd23f, 0 4px 0 rgba(0, 0, 0, .25); }
.ticket.vip::after { border-block-start-color: #fff3c4; }
.ticket.bad { box-shadow: 0 0 0 3px var(--bad), 0 4px 0 rgba(0, 0, 0, .25); }
.tk-top { position: relative; display: flex; justify-content: center; }
.ticket .order { display: block; inline-size: 74%; max-inline-size: 84px; block-size: auto; }
.doneness {
    position: absolute; inset-block-end: -2px; inset-inline-end: -2px; display: inline-flex; align-items: center; gap: 2px;
    font-size: .62rem; font-weight: 800; padding-block: 1px; padding-inline: 3px 6px; border-radius: 99px; background: #fff3c4; color: #7a5200;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .2);
}
.doneness svg { inline-size: 14px; block-size: 14px; }
.doneness.crisp { background: #ffe0c7; color: #a33a00; box-shadow: 0 0 0 1.5px #ff7a1a; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; margin-block-start: 4px; }
.chip {
    position: relative; display: grid; place-items: center; inline-size: 20px; block-size: 18px; border-radius: 6px; background: #f1e6d6;
    transition: background-color .15s;
}
.chip svg { inline-size: 18px; block-size: 14px; }
.chip.done { background: #c9f2d5; }
.chip.done::after {
    content: ""; position: absolute; inset-block-start: -4px; inset-inline-end: -4px; inline-size: 9px; block-size: 9px; border-radius: 50%;
    background: #49d17d url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2.4 5.2l1.7 1.7 3.5-3.8' stroke='%23fff' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% no-repeat;
}
.ticket.target { box-shadow: 0 0 0 2px #ffcf3d, 0 4px 0 rgba(0, 0, 0, .25); }
.patience { block-size: 6px; margin-block-start: 4px; border-radius: 99px; background: #eadccd; overflow: hidden; }
.patience i { display: block; block-size: 100%; inline-size: 100%; border-radius: inherit; background: var(--ok); transform-origin: left; }
[dir="rtl"] .patience i { transform-origin: right; }

.kk-float {
    position: absolute; z-index: 5; inset-inline: 0; inset-block-start: 30%; text-align: center; pointer-events: none;
    font-weight: 900; font-size: 1.35rem; color: var(--accent); text-shadow: 0 2px 0 rgba(0, 0, 0, .35);
    animation: rise 1.05s ease-out forwards;
}
.kk-float small { display: block; font-size: .72rem; font-weight: 700; color: #fff; }
.kk-float.bad { color: var(--bad); }
.kk-float.close { color: #b8e6ff; }
.kk-float.vip { color: #ffd23f; font-size: 1.6rem; }
.kk-float.crisp { color: #ffb36b; inset-block-start: 10%; font-size: 1.15rem; }
@keyframes rise { from { transform: translateY(10px) scale(.8); opacity: 0; } 20% { transform: none; opacity: 1; } to { transform: translateY(-46px); opacity: 0; } }

.rush, .combo {
    position: absolute; z-index: 4; inset-inline: 0; display: flex; justify-content: center; pointer-events: none;
    opacity: 0; transition: opacity .25s, transform .25s; transform: scale(.9);
}
.rush { inset-block-start: 42%; }
.combo { inset-block-end: 34px; }
.rush.on, .combo.on { opacity: 1; transform: none; }
.rush span, .combo span {
    background: rgba(24, 12, 16, .92); border: 1px solid var(--accent); border-radius: 999px; padding: 6px 16px;
    font-weight: 800; font-size: 1rem; box-shadow: 0 0 20px rgba(255, 207, 61, .3);
}
.combo span { border-color: var(--accent2); color: #ffe9d6; box-shadow: 0 0 20px rgba(255, 138, 61, .35); }

/* Overlay (start, pause, results) */
.overlay {
    position: absolute; z-index: 10; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: safe center;
    gap: 10px; padding: 20px 16px; text-align: center; background: rgba(24, 12, 16, .92); backdrop-filter: blur(4px); overflow-y: auto; border-radius: 16px;
}
.overlay.on { display: flex; }
.overlay h2 { margin: 0; font-size: 1.5rem; }
.overlay p { margin: 0; max-inline-size: 30em; color: var(--muted); line-height: 1.5; }
@keyframes bob { 50% { transform: translateY(-5px) rotate(8deg); } }
.overlay .count { font-size: 4rem; font-weight: 900; color: var(--accent); animation: bump .5s; }
.overlay .recipe { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; align-items: center; }
.overlay .recipe span { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; background: rgba(255, 255, 255, .08); border-radius: 8px; padding-block: 3px; padding-inline: 4px 8px; }
.overlay .recipe svg { inline-size: 30px; block-size: auto; }
.overlay .big { font-size: 2.6rem; font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; }
.overlay .rank { font-weight: 800; color: var(--accent2); }
.overlay .row { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; color: var(--muted); font-size: .9rem; }
.overlay .row b { color: var(--text); }
.btn {
    border: 0; border-radius: 14px; padding: 12px 26px; font-weight: 800; font-size: 1.05rem; cursor: pointer;
    background: linear-gradient(#ffe066, #ffbe1a); color: var(--ink); box-shadow: 0 4px 0 #b37a00; touch-action: manipulation;
}
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #b37a00; }
.btn.ghost { background: var(--surface2); color: var(--text); box-shadow: 0 4px 0 #120804; }
.note { color: var(--muted); }
.note.ok { color: var(--ok); }
.note.bad { color: var(--bad); }

/* Prep station: bin, the board, serve */
.station { display: grid; grid-template-columns: 64px 1fr 96px; gap: 8px; align-items: center; margin-block: 8px; }
.bin, .act {
    block-size: 100%; min-block-size: 96px; border-radius: 14px; cursor: pointer; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 4px; padding: 6px 4px; touch-action: manipulation;
}
.bin { background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: .74rem; }
.bin svg { inline-size: 30px; block-size: 30px; }
.bin:active { transform: scale(.95); }
.act {
    border: 0; background: var(--surface2); color: var(--muted); font-weight: 900; font-size: 1.05rem;
    box-shadow: 0 4px 0 #120804; transition: background-color .15s, color .15s;
}
.act { position: relative; }
.act svg { inline-size: 30px; block-size: 30px; opacity: .45; }
.act kbd { position: absolute; inset-block-start: 4px; inset-inline-start: 6px; }
.act.on { background: linear-gradient(#ffb067, #ff7a1a); color: #3a1300; box-shadow: 0 4px 0 #b14a00; }
.act.on svg { opacity: 1; }
.act.want { animation: want 1s ease-in-out infinite; }
.act.pulse { animation: ready 1s ease-in-out infinite; }
.act:active { transform: translateY(2px); }
@keyframes ready { 50% { transform: scale(1.04); } }
@keyframes want { 50% { box-shadow: 0 0 0 4px var(--accent), 0 0 18px rgba(255, 207, 61, .7); } }
.board-wrap { position: relative; text-align: center; }
.board {
    position: relative; margin-inline: auto; max-inline-size: 150px; aspect-ratio: 1; padding: 8px; border-radius: 50%;
    background:
        repeating-linear-gradient(100deg, rgba(0, 0, 0, .05) 0 3px, transparent 3px 11px),
        radial-gradient(circle, #dba56c, #b97a44);
    box-shadow: 0 5px 0 #7a4a22, inset 0 2px 0 rgba(255, 255, 255, .3);
}
.board svg { display: block; inline-size: 100%; block-size: auto; overflow: visible; }
.board svg.drop > :last-child { animation: drop .25s cubic-bezier(.3, 1.4, .5, 1); }
.board svg.drop { animation: squish .2s ease-out; }
@keyframes squish { 50% { transform: scale(1.04); } }
@keyframes drop { from { transform: translateY(-24px); opacity: 0; } }
.board-wrap.nope .board { animation: shake .3s; }
.fly { position: absolute; z-index: 6; inset-block-start: 8px; inset-inline: 0; margin-inline: auto; max-inline-size: 134px; pointer-events: none; }
.fly svg { display: block; inline-size: 100%; block-size: auto; }
.fly.sent { animation: sent .6s cubic-bezier(.5, 0, .7, 1) forwards; }
.fly.toss { animation: tossed .5s ease-in forwards; }
@keyframes sent { 0% { transform: scale(1.1, .6); } 25% { transform: translateY(-10px) scale(1.05); } 85% { opacity: 1; } to { transform: translate(var(--dx, 0), var(--dy, -140px)) scale(.5); opacity: 0; } }
@keyframes tossed { to { transform: translate(-60px, 30px) rotate(-40deg) scale(.7); opacity: 0; } }
[dir="rtl"] .fly.toss { animation-name: tossed-rtl; }
@keyframes tossed-rtl { to { transform: translate(60px, 30px) rotate(40deg) scale(.7); opacity: 0; } }
.board-label { margin: 6px 0 0; min-block-size: 1.3em; font-size: .8rem; color: var(--muted); }
.board-label.bad { color: var(--bad); font-weight: 700; }

/* Bread and add-on trays */
.trays { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tray {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 4px;
    border-radius: 14px; cursor: pointer; border: 1px solid #f3f5f8; touch-action: manipulation;
    background: linear-gradient(#f6f8fb, #cdd5df); color: #2a1208; box-shadow: 0 4px 0 #7d8896;
    transition: transform .06s;
}
.tray.bread { background: linear-gradient(#fff3d9, #e9cf9c); border-color: #fff7e6; box-shadow: 0 4px 0 #a37a3e; }
.tray svg { flex: none; inline-size: 40px; block-size: 32px; filter: drop-shadow(0 2px 1px rgba(0, 0, 0, .25)); transition: transform .08s; }
.tray.nope { animation: shake .3s; }
.tray.want { animation: want 1s ease-in-out infinite; }
.tray span { font-size: .76rem; font-weight: 800; line-height: 1.15; text-align: center; }
.tray kbd { position: absolute; inset-block-start: 3px; inset-inline-start: 6px; }
.tray .left { position: absolute; inset-block-start: 3px; inset-inline-end: 6px; font: 900 .72rem var(--font); font-style: normal; color: #b35a00; }
.tray.out svg { filter: grayscale(.8) opacity(.5); }
.tray:active, .tray.hit { transform: translateY(3px); box-shadow: 0 1px 0 #7d8896; }
.tray:active svg, .tray.hit svg { transform: scale(1.14) rotate(-8deg); }

.keys, .mode { margin: 8px 0 0; text-align: center; font-size: .8rem; color: var(--muted); }
.mode:empty, .keys:empty { display: none; }
@media (hover: none) { .keys, .tray kbd, .spit kbd, .pan kbd, .fryer kbd, .act kbd { display: none; } }

@media (max-width: 559px) {
    .lights { display: none; }
    .sign { inset-block-start: 40px; }
    .sign b { font-size: 1.15rem; padding: 3px 14px; opacity: .55; }
    .board { max-inline-size: 118px; }
    .bin, .act { min-block-size: 84px; }
}
@media (max-width: 380px) {
    .slot { min-block-size: 200px; }
    .station { grid-template-columns: 56px 1fr 84px; }
    .tray svg { inline-size: 34px; block-size: 28px; }
    .tray span { font-size: .7rem; }
}
@media (min-width: 560px) {
    .slot { min-block-size: 236px; }
    .ticket { max-inline-size: 150px; }
    .ticket .order { max-inline-size: 96px; }
    .trays { grid-template-columns: repeat(8, 1fr); }
}
/* ---------- polish: particle layer, edge flashes, entrances, end screen ---------- */
.fx { position: absolute; z-index: 11; inset: 0; inline-size: 100%; block-size: 100%; pointer-events: none; }
.game::after {
    content: ""; position: absolute; z-index: 9; inset: 0; pointer-events: none; border-radius: 16px; opacity: 0;
    box-shadow: inset 0 0 60px 10px rgba(255, 60, 50, .55);
}
.game.hurt::after { animation: edge .6s ease-out; }
.game.cheer::after { box-shadow: inset 0 0 60px 10px rgba(255, 207, 61, .45); animation: edge .8s ease-out; }
.game.last-heart::after { animation: lastheart 1.1s ease-in-out infinite; }
@keyframes edge { 15% { opacity: 1; } }
@keyframes lastheart { 50% { opacity: .55; } }
.jolt { animation: jolt .32s ease-out; }
@keyframes jolt { 20% { transform: translate(-4px, 2px); } 45% { transform: translate(4px, -1px); } 70% { transform: translate(-2px, 0); } }
.stat b.low { animation: tick 1s ease-in-out infinite; }
@keyframes tick { 0%, 100% { transform: none; } 10% { transform: scale(1.18); } }
.game.last-heart .hearts svg:not(.lost) { animation: beat .55s ease-in-out infinite; transform-origin: 50% 60%; }
@keyframes beat { 30% { transform: scale(1.25); } }
.overlay.on > * { animation: enter .45s cubic-bezier(.2, .9, .3, 1.2) both; }
.overlay.on > :nth-child(2) { animation-delay: .06s; }
.overlay.on > :nth-child(3) { animation-delay: .12s; }
.overlay.on > :nth-child(4) { animation-delay: .18s; }
.overlay.on > :nth-child(n+5) { animation-delay: .24s; }
@keyframes enter { from { opacity: 0; transform: translateY(14px) scale(.96); } }
.overlay.on > .count { animation: countpop .55s cubic-bezier(.2, .9, .3, 1.5); text-shadow: 0 0 30px rgba(255, 207, 61, .6); }
@keyframes countpop { from { transform: scale(2.2); opacity: 0; } }
.overlay.on > .rank {
    display: inline-block; padding: 4px 14px; border: 2px solid currentColor; border-radius: 10px; transform: rotate(-4deg);
    animation: stamp .5s .35s cubic-bezier(.3, 1.6, .5, 1) both;
}
@keyframes stamp { from { transform: rotate(-4deg) scale(2.4); opacity: 0; } }
.overlay .big.landed { animation: land .35s ease-out; }
@keyframes land { 40% { transform: scale(1.15); color: #fff; } }
.overlay .record {
    font-weight: 900; font-size: .95rem; color: #2a1206; background: linear-gradient(#ffe27a, #ffb627); padding: 5px 14px; border-radius: 999px;
    box-shadow: 0 0 22px rgba(255, 207, 61, .6); animation: stamp .5s cubic-bezier(.3, 1.6, .5, 1) both, btnglow 2s 1s ease-in-out infinite;
}
.overlay.on > .btn:not(.ghost) { animation: enter .45s .24s both, btnglow 2.2s 1s ease-in-out infinite; }
@keyframes btnglow { 50% { box-shadow: 0 4px 0 #b37a00, 0 0 22px rgba(255, 207, 61, .6); } }
.combo.on span { animation: comboin .45s cubic-bezier(.2, .9, .3, 1.5); }
@keyframes comboin { from { transform: scale(.4) rotate(-8deg); } }
.slot.happy .who { animation: cheer .4s ease-out; }
@keyframes cheer { 40% { transform: translateY(-12px) scale(1.06); } }
.shop::before {
    content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
    background: radial-gradient(60% 40% at 50% 100%, rgba(255, 150, 60, .22), transparent 70%);
    animation: flicker 5s ease-in-out infinite;
}
@keyframes flicker { 0%, 100% { opacity: 1; } 40% { opacity: .8; } 42% { opacity: 1; } 70% { opacity: .9; } }
.counter::after { content: ""; position: absolute; inset-inline: 0; inset-block-start: -4px; block-size: 2px; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .9), transparent); }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* The grill: two turning spits over their pans, and the fryer. */
.grill {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-block-start: 8px; padding: 8px 6px 6px; border-radius: 16px;
    background:
        repeating-linear-gradient(90deg, rgba(255, 255, 255, .04) 0 2px, transparent 2px 9px),
        linear-gradient(#5d6672, #3c434d);
    border: 2px solid #262b32; box-shadow: 0 4px 0 #15181c, inset 0 2px 0 rgba(255, 255, 255, .15);
}
.col { display: flex; flex-direction: column; gap: 6px; min-inline-size: 0; }
.spit, .fryer {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px;
    block-size: 158px; border: 0; padding: 0 0 4px; cursor: pointer; touch-action: manipulation; color: #fff; border-radius: 12px;
    background: radial-gradient(ellipse at 50% 30%, #2b1810, #120a07 75%); box-shadow: inset 0 3px 10px rgba(0, 0, 0, .7), 0 0 0 2px #8f97a3;
    overflow: hidden;
}
.spit kbd, .fryer kbd, .pan kbd { position: absolute; inset-block-start: 3px; inset-inline-start: 6px; color: #fff; z-index: 3; }
.pan kbd { color: #1d2228; }
.spit .nm { position: absolute; inset-block-start: 3px; inset-inline-end: 6px; z-index: 3; font-size: .66rem; font-weight: 800; color: #ffe2b8; opacity: .85; }
.heater { position: absolute; inset-block: 14px 34px; inset-inline-start: 6%; inline-size: 16%; display: flex; flex-direction: column; gap: 3px; }
.heater i { flex: 1; border-radius: 3px; background: linear-gradient(90deg, #5a1a08, #ff6a1a 60%, #ffcf6a); box-shadow: 0 0 10px #ff6a1a; animation: heat 1.4s ease-in-out infinite alternate; }
.heater i:nth-child(2) { animation-delay: .4s; }
.heater i:nth-child(3) { animation-delay: .8s; }
@keyframes heat { to { filter: brightness(1.35); box-shadow: 0 0 18px #ff8a2a; } }
.rod { position: absolute; inset-block: 6px 30px; inset-inline-start: calc(55% - 2px); inline-size: 4px; border-radius: 2px; background: linear-gradient(90deg, #8f97a3, #eef1f5, #8f97a3); }
.cap { position: absolute; inset-block-start: 12px; inset-inline-start: calc(55% - 30%); inline-size: 60%; block-size: 6px; border-radius: 3px; background: linear-gradient(#c9ced6, #6c7480); }
.cone {
    position: absolute; inset-block: 17px 38px; inset-inline-start: calc(55% - 28%); inline-size: 56%;
    clip-path: polygon(0 0, 100% 0, 78% 100%, 22% 100%); background: var(--meat, #e6a74a); transition: background-color .3s;
}
.cone i { position: absolute; inset: 0; }
.cone .turn {
    background: repeating-linear-gradient(90deg, var(--edge, #b8742a) 0 3px, transparent 3px 11px),
        repeating-linear-gradient(0deg, rgba(0, 0, 0, .18) 0 2px, transparent 2px 9px);
    opacity: .55; animation: turn 1.6s linear infinite;
}
[dir="rtl"] .cone .turn { animation-direction: reverse; }
@keyframes turn { to { background-position: 22px 0, 0 0; } }
.cone .shade { background: linear-gradient(90deg, rgba(0, 0, 0, .45), transparent 30%, rgba(255, 230, 180, .3) 48%, transparent 62%, rgba(0, 0, 0, .55)); }
.cone .glint { opacity: 0; background: repeating-linear-gradient(90deg, transparent 0 9px, rgba(255, 240, 200, .8) 9px 10px, transparent 10px 23px); animation: turn 1.6s linear infinite; }
.spit.s2 .glint { opacity: .55; }
.spit.s1 .cone, .spit.s2 .cone { filter: drop-shadow(0 0 6px rgba(255, 170, 60, .6)); }
.spit.s3 .cone { filter: saturate(.4); }
.spit.s3 .cone::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 30%, rgba(90, 90, 90, .7), transparent 60%); animation: steam 1.2s ease-out infinite; }
@keyframes steam { from { opacity: 0; } 40% { opacity: 1; } to { opacity: 0; transform: translateY(-12px); } }
.spit.warn .cone { animation: sizzle .12s linear infinite; }
@keyframes sizzle { 50% { transform: translateX(1px); } }
.spit .knife { position: absolute; z-index: 2; inset-block-start: 40%; inset-inline-end: -40%; inline-size: 46%; opacity: 0; pointer-events: none; }
.spit .knife svg { display: block; inline-size: 100%; block-size: auto; }
.spit .knife.go { animation: knife .32s ease-out; }
@keyframes knife { 0% { opacity: 1; transform: translate(0, -18px) rotate(-20deg); } 60% { opacity: 1; transform: translate(-80%, 22px) rotate(8deg); } 100% { opacity: 0; transform: translate(-95%, 30px) rotate(10deg); } }
[dir="rtl"] .spit .knife { transform: scaleX(-1); }
[dir="rtl"] .spit .knife.go { animation-name: knife-rtl; }
@keyframes knife-rtl { 0% { opacity: 1; transform: scaleX(-1) translate(0, -18px) rotate(-20deg); } 60% { opacity: 1; transform: scaleX(-1) translate(-80%, 22px) rotate(8deg); } 100% { opacity: 0; transform: scaleX(-1) translate(-95%, 30px) rotate(10deg); } }
.bar { position: relative; z-index: 2; inline-size: 82%; block-size: 7px; border-radius: 99px; overflow: hidden; background: rgba(255, 255, 255, .14); }
.spit .bar { background: linear-gradient(90deg, rgba(255, 255, 255, .14) 0 var(--g), rgba(73, 209, 125, .45) 0 var(--c), rgba(255, 159, 42, .5) 0 92%, rgba(255, 95, 87, .6) 0); }
.m0 .spit .bar { --g: 33%; --c: 75%; }
.m1 .spit .bar { --g: 41%; --c: 78%; }
.bar i { display: block; block-size: 100%; inline-size: 100%; border-radius: inherit; transform-origin: left; transform: scaleX(0); box-shadow: 0 0 6px currentColor; }
[dir="rtl"] .bar i { transform-origin: right; }
.spit .st, .fryer .st { position: relative; z-index: 2; font-size: .68rem; font-weight: 800; min-block-size: 1.2em; color: var(--muted); }
.spit.s1 .st { color: #8ff0ae; }
.spit.s2 .st { color: #ffb36b; }
.spit.warn .st, .spit.s3 .st, .fryer.f3 .st { color: var(--bad); }
.fryer.f2 .st { color: #8ff0ae; }
.spit.nope, .fryer.nope, .pan.nope { animation: shake .3s; }
.spit.want, .fryer.want, .pan.want { animation: want 1s ease-in-out infinite; }
.spit:active, .fryer:active, .pan:active { transform: translateY(2px); }

.pan {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; block-size: 62px;
    border: 0; border-radius: 12px; padding: 4px; cursor: pointer; touch-action: manipulation; color: #1d2228;
    background: linear-gradient(#eef1f5, #b9c1cc); box-shadow: 0 4px 0 #6c7480, inset 0 2px 0 #fff;
}
.pan .pile { display: grid; place-items: center; block-size: 32px; inline-size: 100%; }
.pan .pile svg { inline-size: 52px; block-size: 40px; filter: drop-shadow(0 2px 1px rgba(0, 0, 0, .3)); }
.pan .pile.bump svg { animation: drop .25s cubic-bezier(.3, 1.4, .5, 1); }
.pan .cnt { font-size: .7rem; font-weight: 800; }
.pan.empty .cnt { opacity: .55; }
.pan.full { box-shadow: 0 4px 0 #2f8a24, inset 0 2px 0 #fff, 0 0 0 2px #49d17d; }

.vat {
    position: absolute; inset-block-end: 30px; inset-inline: 10%; block-size: 62%; border-radius: 6px 6px 14px 14px; overflow: hidden;
    background: linear-gradient(#9aa3ae, #59616c); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .4);
}
.vat .oil { position: absolute; inset-inline: 6%; inset-block: 32% 8%; border-radius: 4px 4px 10px 10px; background: linear-gradient(#e7b13a, #b8761a); overflow: hidden; }
.vat .oil i { position: absolute; inset-block-end: -6px; inline-size: 7px; block-size: 7px; border-radius: 50%; background: rgba(255, 240, 190, .8); opacity: 0; }
.vat .oil i:nth-child(1) { inset-inline-start: 18%; }
.vat .oil i:nth-child(2) { inset-inline-start: 42%; animation-delay: .25s !important; }
.vat .oil i:nth-child(3) { inset-inline-start: 64%; animation-delay: .5s !important; }
.vat .oil i:nth-child(4) { inset-inline-start: 82%; animation-delay: .1s !important; }
.fryer.f1 .oil i, .fryer.f2 .oil i { animation: bubble .7s ease-in infinite; }
@keyframes bubble { 0% { opacity: .9; transform: translateY(0) scale(.6); } 100% { opacity: 0; transform: translateY(-34px) scale(1.2); } }
.vat .basket {
    position: absolute; z-index: 1; inset-inline: 16%; inset-block-start: 4%; block-size: 50%; border: 2px solid #dfe3e8; border-block-start: 0; border-radius: 0 0 8px 8px;
    background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .35) 0 1px, transparent 1px 5px), repeating-linear-gradient(-45deg, rgba(255, 255, 255, .35) 0 1px, transparent 1px 5px);
    transition: transform .35s cubic-bezier(.3, 1.3, .5, 1);
}
.vat .basket::before { content: ""; position: absolute; inset-block-start: -2px; inset-inline-end: -26%; inline-size: 30%; block-size: 3px; background: #2a1a12; border-radius: 2px; }
.fryer.f1 .basket, .fryer.f2 .basket, .fryer.f3 .basket { transform: translateY(58%); }
.vat .fries {
    position: absolute; inset: 18% 10% 6%; opacity: 0;
    background: repeating-linear-gradient(80deg, transparent 0 2px, var(--fc, #ffe6a0) 2px 5px, transparent 5px 8px);
    --fc: color-mix(in srgb, #ffe6a0, #e9a92a calc(var(--fry, 0) * 100%));
    filter: brightness(calc(1 - var(--burn, 0) * .7));
}
.fryer.f1 .fries, .fryer.f2 .fries, .fryer.f3 .fries { opacity: 1; }
.fryer.f2 .vat { box-shadow: inset 0 2px 0 rgba(255, 255, 255, .4), 0 0 14px rgba(255, 200, 60, .55); }
.fries-box { white-space: nowrap; block-size: 62px; display: grid; place-items: center; border-radius: 12px; font-size: .74rem; font-weight: 800; color: #ffe08a; background: rgba(0, 0, 0, .22); border: 1px dashed rgba(255, 255, 255, .2); }
.fries-box:empty::before { content: "—"; opacity: .4; }

/* Serve button: lights up when the sandwich has bread and meat. */
.act small { font-size: .62rem; font-weight: 700; opacity: .8; min-block-size: 1em; }
.act.on { background: linear-gradient(#a3ee8f, #5ccf4a); color: #0d2a08; box-shadow: 0 4px 0 #2f8a24; }
.act.nope { animation: shake .3s; }
.board { border-radius: 18px; background: repeating-linear-gradient(100deg, rgba(0, 0, 0, .05) 0 3px, transparent 3px 11px), linear-gradient(#e9eef3, #b9c3ce); box-shadow: 0 5px 0 #6c7480, inset 0 2px 0 #fff; }

.overlay .hero { position: relative; display: flex; align-items: center; gap: 10px; }
.overlay .hero > svg { inline-size: 110px; block-size: auto; animation: bob 2.4s ease-in-out infinite; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .4)); }
.hero-spit { position: relative; inline-size: 44px; block-size: 76px; }
.hero-spit::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: calc(50% - 1.5px); inline-size: 3px; background: #c9ced6; border-radius: 2px; }
.hero-spit i {
    position: absolute; inset-block: 8px 10px; inset-inline: 0; clip-path: polygon(0 0, 100% 0, 78% 100%, 22% 100%);
    background: repeating-linear-gradient(90deg, #b8742a 0 3px, transparent 3px 10px), linear-gradient(90deg, #8a4a1a, #e6a74a 45%, #8a4a1a);
    animation: turn 1.6s linear infinite;
}
.overlay .spit-help { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--text); }
.sw { display: inline-block; inline-size: 14px; block-size: 14px; border-radius: 4px; }
.sw.g { background: #e6a74a; } .sw.c { background: #a85f22; } .sw.x { background: #2e2018; box-shadow: 0 0 0 1px #888; }

@media (max-width: 559px) {
    .spit, .fryer { block-size: 136px; }
    .pan, .fries-box { block-size: 56px; }
    .trays .tray svg { inline-size: 34px; block-size: 28px; }
}
@media (min-width: 560px) {
    .spit, .fryer { block-size: 170px; }
}
/* ---------- polish 2: compliments, combo fire, music switch. New keyframes use ss- names. ---------- */
.ss-word {
    position: absolute; z-index: 12; transform: translate(-50%, -50%); pointer-events: none; white-space: nowrap;
    font: 900 1.15rem var(--font); color: #fff6c4; letter-spacing: .02em;
    -webkit-text-stroke: 1px rgba(80, 30, 0, .5); text-shadow: 0 3px 0 #b34d12, 0 0 14px rgba(255, 170, 60, .55);
    animation: ss-word .95s cubic-bezier(.2, .9, .3, 1.3) forwards;
}
.ss-word.warm { font-size: 1.35rem; color: #ffd23f; }
.ss-word.hot { font-size: 1.55rem; color: #fff; text-shadow: 0 3px 0 #d0331a, 0 0 18px rgba(255, 110, 40, .85); }
@keyframes ss-word {
    0% { transform: translate(-50%, -30%) scale(.3) rotate(-8deg); opacity: 0; }
    22% { transform: translate(-50%, -50%) scale(1.15) rotate(3deg); opacity: 1; }
    40% { transform: translate(-50%, -50%) scale(1) rotate(0); }
    75% { opacity: 1; }
    100% { transform: translate(-50%, -110%) scale(.95); opacity: 0; }
}
/* combo of 5 or more: flames lick up along the top of the grill and the score box glows */
.grill { position: relative; }
.grill::before {
    content: ""; position: absolute; z-index: 0; inset: -10px -6px auto; block-size: 34px; pointer-events: none; opacity: 0;
    border-radius: 50% 50% 0 0 / 100% 100% 0 0; filter: blur(6px);
    background: radial-gradient(40% 100% at 18% 100%, #ffcf3d, transparent), radial-gradient(40% 100% at 50% 100%, #ff8a3d, transparent), radial-gradient(40% 100% at 82% 100%, #ff5a2b, transparent);
    transform: translateY(-14px); transition: opacity .4s;
}
.grill > * { position: relative; z-index: 1; }
.game.fire .grill::before { opacity: .9; animation: ss-flame .42s ease-in-out infinite alternate; }
@keyframes ss-flame { from { transform: translateY(-14px) scaleY(.85); opacity: .65; } to { transform: translateY(-17px) scaleY(1.12); opacity: 1; } }
.game.fire .stat.wide { border-color: var(--accent2); box-shadow: 0 0 14px rgba(255, 138, 61, .45); }
/* the music switch makes the HUD one button wider: tighten it on small phones */
@media (max-width: 420px) {
    .hud { gap: 5px; }
    .hud .icon { inline-size: 38px; block-size: 40px; }
    .hud .icon svg { inline-size: 20px; block-size: 20px; }
    .stat .k { font-size: .66rem; }
    .hearts svg { inline-size: 15px; block-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
