/* Burger Rush. Logical properties, so RTL and LTR share one file. */
:root {
    --bg: #1f0f0a; --surface: #33190f; --surface2: #462315; --border: #6a3520; --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: red and white awning, a menu board, 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, .3), transparent 60%),
        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),
        linear-gradient(#5a2a18, #7a3a1f 60%, #8e4625);
    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, #e8352a 0 28px, #fff4e6 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);
}
.menu-board {
    position: absolute; inset-inline: 10%; inset-block-start: 46px; block-size: 34px; display: flex; gap: 10%; justify-content: center;
    pointer-events: none;
}
.menu-board i {
    flex: 0 1 70px; border-radius: 6px; background: #1d1310; border: 2px solid #8e5a3a; opacity: .8;
    background-image: linear-gradient(#ffcf3d, #ffcf3d), linear-gradient(rgba(255, 255, 255, .5), rgba(255, 255, 255, .5)), linear-gradient(rgba(255, 255, 255, .35), rgba(255, 255, 255, .35));
    background-size: 40% 3px, 70% 2px, 55% 2px; background-position: 50% 7px, 50% 16px, 50% 23px; background-repeat: no-repeat;
}
.sign { position: absolute; inset-inline: 0; inset-block-start: 90px; 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 burger drawn layer by layer, bottom bun to top bun. */
.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); }
.ticket .order { display: block; inline-size: 100%; block-size: auto; max-block-size: 104px; }
.order .ly .hl { fill: none; stroke: none; }
.order .ly .ck { display: none; }
.order .ly.done .ck { display: inline; }
.order .ly.next .hl { fill: rgba(255, 207, 61, .35); stroke: #e0a400; stroke-width: 1.6; animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .45; } }
.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; }
@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(31, 15, 10, .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(31, 15, 10, .9); 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; }
.overlay .hero-burger { inline-size: 120px; block-size: auto; animation: bob 2.4s ease-in-out infinite; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .4)); }
@keyframes bob { 50% { transform: translateY(-5px) rotate(-2deg); } }
.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: 34px; 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); }

/* Grill: a fridge button for raw patties and three hot spots. */
.grill-row { display: grid; grid-template-columns: 76px 1fr; gap: 8px; margin-block-start: 8px; }
.fridge {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    border-radius: 14px; cursor: pointer; padding: 6px 4px; touch-action: manipulation;
    background: linear-gradient(#e9f3fb, #b9cfe0); color: #1b3346; border: 1px solid #fff; box-shadow: 0 4px 0 #6f8aa0;
    font-size: .78rem; font-weight: 800;
}
.fridge svg { inline-size: 40px; block-size: 40px; }
.fridge kbd { position: absolute; inset-block-start: 3px; inset-inline-start: 6px; }
.fridge:active { transform: translateY(3px); box-shadow: 0 1px 0 #6f8aa0; }
.fridge.want, .tray.want, .spot.want { animation: want 1s ease-in-out infinite; }
@keyframes want { 50% { box-shadow: 0 0 0 4px var(--accent), 0 0 18px rgba(255, 207, 61, .7); } }
.grill {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 6px; border-radius: 14px;
    background:
        repeating-linear-gradient(90deg, #2a2a2e 0 6px, #141416 6px 12px),
        #141416;
    border: 3px solid #4a4a52; box-shadow: inset 0 0 18px rgba(255, 90, 30, .45), 0 4px 0 #0b0b0c;
}
.grill.nope { animation: shake .3s; }
.spot {
    position: relative; aspect-ratio: 1.25; min-block-size: 64px; border: 0; border-radius: 12px; padding: 0; cursor: pointer;
    background: radial-gradient(circle, rgba(255, 110, 40, .25), transparent 70%); display: grid; place-items: center; touch-action: manipulation;
}
.spot kbd { position: absolute; inset-block-start: 3px; inset-inline-start: 6px; color: #fff; z-index: 2; }
.spot .ring { position: absolute; inset: 10% 18%; border-radius: 50%; opacity: 0; transition: opacity .2s; -webkit-mask: radial-gradient(closest-side, transparent 80%, #000 82%); mask: radial-gradient(closest-side, transparent 80%, #000 82%); }
.spot svg { position: relative; inline-size: 62%; block-size: auto; opacity: 0; transform: scale(.6); transition: opacity .15s, transform .2s cubic-bezier(.2, .9, .3, 1.4); }
.spot.s1 svg, .spot.s2 svg, .spot.s3 svg { opacity: 1; transform: none; }
.spot.s1 .ring, .spot.s2 .ring { opacity: 1; }
.spot.s1 svg { animation: sizzle .25s linear infinite; }
.spot.s2 { background: radial-gradient(circle, rgba(73, 209, 125, .3), transparent 70%); }
.spot.s2 svg { animation: ready-bob .8s ease-in-out infinite; }
.spot.s2.warn svg { animation: sizzle .12s linear infinite; }
.spot.s3 { background: radial-gradient(circle, rgba(255, 60, 60, .25), transparent 70%); }
.spot.nope svg { animation: shake .3s; }
@keyframes sizzle { 50% { transform: translateY(-1px); } }
@keyframes ready-bob { 50% { transform: translateY(-3px) scale(1.04); } }
.steam { position: absolute; inset-block-start: -2px; inset-inline: 0; display: none; justify-content: center; gap: 6px; pointer-events: none; }
.steam i { inline-size: 6px; block-size: 18px; border-radius: 99px; background: rgba(255, 255, 255, .45); filter: blur(2px); animation: steam 1.2s ease-out infinite; }
.steam i:nth-child(2) { animation-delay: .4s; } .steam i:nth-child(3) { animation-delay: .8s; }
.spot.s1 .steam, .spot.s2 .steam, .spot.s3 .steam { display: flex; }
.spot.s3 .steam i { background: rgba(60, 60, 60, .8); block-size: 24px; }
@keyframes steam { from { transform: translateY(8px) scaleY(.6); opacity: 0; } 40% { opacity: 1; } to { transform: translateY(-14px) scaleY(1.2); opacity: 0; } }

/* 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 small { font-size: .68rem; font-weight: 600; opacity: .85; text-align: center; }
.act.serve { background: linear-gradient(#a3ee8f, #5ccf4a); color: #0d2a08; box-shadow: 0 4px 0 #2f8a24; }
.act.pulse { animation: ready 1s ease-in-out infinite; }
.act:active { transform: translateY(2px); }
@keyframes ready { 50% { transform: scale(1.04); } }
.board-wrap { position: relative; text-align: center; }
.board {
    position: relative; margin-inline: auto; max-inline-size: 190px; padding: 4px 10px 10px; border-radius: 12px;
    background: linear-gradient(#d9a066, #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); }
@keyframes drop { from { transform: translateY(-24px); opacity: 0; } }
.board-wrap.nope .board { animation: shake .3s; }
.fly { position: absolute; z-index: 8; inset-block-start: 4px; inset-inline: 0; margin-inline: auto; max-inline-size: 170px; padding-inline: 10px; pointer-events: none; }
.fly svg { display: block; inline-size: 100%; block-size: auto; }
.fly.sent { animation: sent .55s ease-in forwards; }
.fly.toss { animation: tossed .5s ease-in forwards; }
@keyframes sent { 30% { transform: translateY(-6px) scale(1.05); } to { transform: translateY(-140px) scale(.6); 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; }

/* Topping trays */
.trays { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tray {
    position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 6px;
    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 svg { flex: none; inline-size: 44px; block-size: 30px; filter: drop-shadow(0 2px 1px rgba(0, 0, 0, .25)); }
.tray span { font-size: .8rem; font-weight: 800; line-height: 1.15; text-align: start; }
.tray kbd { position: absolute; inset-block-start: 3px; inset-inline-start: 6px; }
.tray:active, .tray.hit { transform: translateY(3px); box-shadow: 0 1px 0 #7d8896; }

.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, .spot kbd, .fridge kbd { display: none; } }

@media (max-width: 559px) {
    .menu-board { display: none; }
    .sign { inset-block-start: 44px; }
    .sign b { font-size: 1.15rem; padding: 3px 14px; opacity: .55; }
    .board { max-inline-size: 150px; }
    .bin, .act { min-block-size: 84px; }
}
@media (max-width: 380px) {
    .slot { min-block-size: 196px; }
    .station { grid-template-columns: 56px 1fr 84px; }
    .grill-row { grid-template-columns: 64px 1fr; }
    .tray { flex-direction: column; gap: 2px; }
    .tray svg { inline-size: 40px; }
    .tray span { text-align: center; font-size: .74rem; }
}
@media (min-width: 560px) {
    .slot { min-block-size: 232px; }
    .ticket { max-inline-size: 150px; }
    .ticket .order { max-block-size: 118px; }
    .trays { grid-template-columns: repeat(6, 1fr); }
    .tray { flex-direction: column; gap: 3px; }
    .tray span { text-align: center; }
}
/* ---------- polish: particle layer, edge flashes, heat, entrances ---------- */
.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; } }
.shop.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); } }
.hearts svg:not(.lost):last-of-type { transform-origin: 50% 60%; }
.game.last-heart .hearts svg:not(.lost) { animation: beat .55s ease-in-out infinite; }
@keyframes beat { 30% { transform: scale(1.25); } }
.grill.hot { animation: heat 1.6s ease-in-out infinite; }
@keyframes heat {
    50% { box-shadow: inset 0 0 26px rgba(255, 110, 30, .75), 0 0 16px rgba(255, 90, 30, .25), 0 4px 0 #0b0b0c; }
}
.spot.s2::after {
    content: ""; position: absolute; inset: 14% 22%; border-radius: 50%; pointer-events: none;
    box-shadow: 0 0 0 2px rgba(255, 230, 140, .0); animation: doneglow 1s ease-in-out infinite;
}
@keyframes doneglow { 50% { box-shadow: 0 0 14px 3px rgba(255, 220, 120, .55); } }
.overlay .hero { position: relative; }
.overlay .hero .steam { display: flex; inset-block-start: -10px; }
.overlay .hero .steam i { inline-size: 10px; block-size: 26px; filter: blur(4px); }
.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 var(--accent2); 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.on > .btn:not(.ghost) { animation: enter .45s .24s both, glow 2.2s 1s ease-in-out infinite; }
@keyframes glow { 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); } }

/* ---------- polish 2: serve hop, compliments, combo fire, record stamp. New keyframes use br- names. ---------- */
.fly.sent.to { animation: br-serve .62s cubic-bezier(.5, 0, .6, 1) forwards; transform-origin: 50% 100%; }
@keyframes br-serve {
    16% { transform: translateY(3px) scale(1.12, .84); }
    36% { transform: translateY(-18px) scale(.95, 1.08); opacity: 1; }
    100% { transform: translate(var(--dx, 0), var(--dy, -140px)) scale(.32); opacity: .15; }
}
.br-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: br-word .95s cubic-bezier(.2, .9, .3, 1.3) forwards;
}
.br-word.warm { font-size: 1.35rem; color: #ffd23f; }
.br-word.hot { font-size: 1.55rem; color: #fff; text-shadow: 0 3px 0 #d0331a, 0 0 18px rgba(255, 110, 40, .85); }
@keyframes br-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 behind the grill */
.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(60% 100% at 20% 100%, #ffcf3d, transparent), radial-gradient(50% 100% at 55% 100%, #ff8a3d, transparent), radial-gradient(55% 100% at 85% 100%, #ff5a2b, transparent);
    transform: translateY(-14px); transition: opacity .4s;
}
.grill > * { position: relative; z-index: 1; }
.game.fire .grill::before { opacity: .9; animation: br-flame .42s ease-in-out infinite alternate; }
@keyframes br-flame { from { transform: translateY(-14px) scaleY(.85); opacity: .65; } to { transform: translateY(-17px) scaleY(1.12); opacity: 1; } }
.game.fire .stat.wide { border-color: #ff8a3d; }
.overlay.on > .br-best {
    display: inline-block; padding: 3px 12px; border-radius: 999px; font-weight: 900; color: var(--ink);
    background: linear-gradient(90deg, #ffcf3d, #ff8a3d); box-shadow: 0 0 18px rgba(255, 180, 60, .6);
    animation: br-best .55s 1.25s cubic-bezier(.3, 1.6, .5, 1) both;
}
@keyframes br-best { from { transform: scale(2.2) rotate(6deg); opacity: 0; } }
/* 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; }
}
