#view {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: pointer;
}

#view.play { cursor: grab; }
#view.held { cursor: grabbing; }

#sorry {
    position: fixed;
    inset: 0;
    margin: 0;
    display: grid;
    place-items: center;
}

#sorry[hidden] { display: none; }

#bar .gap { margin-left: 14px; }
#volume { padding: 14px 16px; }
#volume input { width: 170px; margin: 0; accent-color: var(--punch); cursor: pointer; }

/* Everything below sits over the picture and lets clicks through. It moves by transform alone, and nothing has a
   blurred shadow: a few of those on big text and the frame rate goes. */
#hint, #tap, #fly, #score { position: fixed; pointer-events: none; }

/* The pointer at the box: a big cartoon arrow, bobbing. */
#tap { left: 0; top: 0; width: 0; height: 0; }
#tap[hidden], #score[hidden], #hint[hidden], #over[hidden] { display: none; }
#tap svg {
    position: absolute;
    left: 0;
    top: 0;
    width: clamp(64px, 11vmin, 120px);
    overflow: visible;
    transform-origin: 14% 12%;
    animation: tap 0.9s ease-in-out infinite;
}
#tap path { fill: #fff; stroke: #000; stroke-width: 2.2; stroke-linejoin: round; paint-order: stroke; }
#tap path.back { fill: var(--punch); }
@keyframes tap { 0%, 100% { transform: translate(14px, 16px) scale(1); } 50% { transform: translate(0, 0) scale(1.14); } }

/* How to play, shown once: a dotted ring round one piece and an arrow to its match. */
#hint { inset: 0; width: 100%; height: 100%; }
#hint * { fill: none; stroke-linecap: round; stroke-linejoin: round; }
#hint .under * { stroke: #000; stroke-width: 9; }
#hint .over * { stroke: var(--punch); stroke-width: 4.5; }
#hint ellipse, #hint .shaft { stroke-dasharray: 1 13; animation: march 0.7s linear infinite; }
#hint .over .head { fill: var(--punch); }
#hint .under .head { fill: #000; }
@keyframes march { to { stroke-dashoffset: -14; } }

/* The score, and the points that fly up out of a merge. */
#score {
    top: max(16px, env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: baseline;
    gap: 13px;
    font: 700 64px/1 "Chakra Petch", ui-sans-serif, system-ui, sans-serif;
    color: #fff;
    -webkit-text-stroke: 9px #000;
    paint-order: stroke fill;
}
#score b { display: block; font-variant-numeric: tabular-nums; }
#score i { font: 700 20px/1 "Chakra Petch", ui-sans-serif, system-ui, sans-serif; color: var(--punch); -webkit-text-stroke: 5px #000; letter-spacing: 0.04em; }

#fly { inset: 0; overflow: hidden; }
#fly span {
    position: absolute;
    left: 0;
    top: 0;
    font: 700 44px/1 "Chakra Petch", ui-sans-serif, system-ui, sans-serif;
    white-space: nowrap;
    -webkit-text-stroke: 7px #000;
    paint-order: stroke fill;
    will-change: transform, opacity;
}
#fly span.mega { font-size: 84px; -webkit-text-stroke-width: 12px; color: var(--punch); }

/* The end: what you ate. */
#over {
    position: fixed;
    inset: 0;
    z-index: 4;
    display: grid;
    place-items: center;
    padding: 16px;
    animation: over-in 0.35s ease-out both;
    /* Only the window itself takes clicks: the badge and the bar still work round it. */
    pointer-events: none;
}
#over .window { pointer-events: auto; }
@keyframes over-in { from { opacity: 0; transform: translateY(14px) scale(0.96); } }
#over .window { width: min(360px, 100%); text-align: center; background: rgba(18, 18, 24, 0.84); }
#over .inner { padding: 30px 30px 26px; }
#over h1 { font-size: 72px; font-variant-numeric: tabular-nums; }
#over .version { margin: 6px 0 20px; font-size: 15px; }
#tally { list-style: none; margin: 0 0 24px; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 18px; }
#tally li { margin: 0; padding: 0; display: flex; align-items: center; gap: 7px; font: 700 20px/1 "Chakra Petch", ui-sans-serif, system-ui, sans-serif; color: #fff; }
#tally i { display: block; box-sizing: border-box; width: 26px; height: 26px; border: 8px solid currentColor; border-radius: 50%; }
#tally i.mega { border: 0; border-radius: 0; background: var(--punch); clip-path: polygon(50% 0, 61% 30%, 93% 18%, 76% 46%, 100% 62%, 68% 66%, 70% 100%, 50% 74%, 30% 100%, 32% 66%, 0 62%, 24% 46%, 7% 18%, 39% 30%); }
#tally li.soggy { color: #b9b3a3; }
#over .row { display: flex; gap: 10px; justify-content: center; }

.btn {
    min-width: 120px;
    padding: 13px 20px;
    font: 700 17px/1 "Chakra Petch", ui-sans-serif, system-ui, sans-serif;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #000;
    background: var(--punch);
    clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
.btn.plain { color: #fff; background: rgba(255, 255, 255, 0.14); }
.btn:hover { background: #fff; color: #000; }
.btn:active { transform: translateY(1px); }

@media (max-width: 480px) {
    #score { font-size: 46px; }
    #fly span { font-size: 28px; }
    #fly span.mega { font-size: 60px; }
}
