/* Murmur UI: almost nothing. A number while you play, a word and a button on the title, a card at the end. */

#stage {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    cursor: default;
}

#title-screen,
#end-screen {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 22px;
    padding: 24px;
    padding-top: max(24px, 9vh);
    pointer-events: none;
}

#title-screen[hidden],
#end-screen[hidden],
#hud[hidden] {
    display: none;
}

/* The name comes up letter by letter, the way the flock arrives. */
#title-name {
    margin: 0;
    display: flex;
    font: 700 clamp(46px, 12vw, 118px)/1 "Chakra Petch", ui-sans-serif, system-ui, sans-serif;
    letter-spacing: 0.22em;
    text-indent: 0.22em;
    color: #fff;
    text-shadow: 0 2px 22px rgba(0, 0, 0, 0.55);
}

#title-name span {
    display: block;
    animation: letter-in 0.9s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

#title-name span:nth-child(2) { animation-delay: 0.09s; }
#title-name span:nth-child(3) { animation-delay: 0.18s; }
#title-name span:nth-child(4) { animation-delay: 0.27s; }
#title-name span:nth-child(5) { animation-delay: 0.36s; }
#title-name span:nth-child(6) { animation-delay: 0.45s; }

@keyframes letter-in {
    from { opacity: 0; transform: translateY(26px) rotate(-6deg); }
}

#title-hint {
    margin: 0;
    font: 500 clamp(11px, 2.4vw, 14px)/1.3 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-align: center;
    text-wrap: balance;
    color: rgba(255, 255, 255, 0.86);
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
    animation: fade-in 1.2s 0.9s both;
}

#play-btn {
    animation: fade-in 0.8s 1.4s both;
}

#title-screen.leaving #title-name,
#title-screen.leaving #title-hint,
#title-screen.leaving #play-btn {
    opacity: 0;
    transition: opacity 0.45s;
}

@keyframes fade-in {
    from { opacity: 0; }
}

.cta {
    --c: 11px;
    --t: 3px;
    --edge: #000;
    pointer-events: auto;
    font: 700 26px/1 "Chakra Petch", ui-sans-serif, system-ui, sans-serif;
    letter-spacing: 0.18em;
    text-indent: 0.18em;
    color: #000;
    background: var(--punch);
    padding: 20px 60px;
    transition: transform 0.12s ease, background 0.12s ease;
    cursor: pointer;
}

.cta:hover {
    transform: scale(1.06);
    background: #fff;
}

.cta:active {
    transform: scale(0.96);
    background: #ffb347;
}

/* The count of birds in the air, small, at the top, out of the way of the badge. */
#hud {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    pointer-events: none;
}

#hud-count {
    display: block;
    padding: 6px 14px;
    background: rgba(10, 14, 24, 0.55);
    --c: 8px;
    --t: 1px;
    --edge: rgba(255, 252, 0, 0.4);
    font: 700 clamp(16px, 3vw, 20px)/1 "Chakra Petch", ui-sans-serif, system-ui, sans-serif;
    letter-spacing: 0.1em;
    font-variant-numeric: tabular-nums;
    color: #fff;
}

#hud-count.bump {
    animation: bump 0.28s ease-out;
}

@keyframes bump {
    30% { transform: scale(1.22); color: var(--punch); }
}

.end-card {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 30px 44px 28px;
    background: rgba(10, 14, 24, 0.78);
    --c: 12px;
    --t: 2px;
    --edge: var(--punch);
    animation: card-in 0.6s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(24px) scale(0.94); }
}

#end-score {
    font: 700 clamp(44px, 10vw, 72px)/1 "Chakra Petch", ui-sans-serif, system-ui, sans-serif;
    letter-spacing: 0.06em;
    font-variant-numeric: tabular-nums;
    color: #fff;
}

#end-label {
    font: 500 13px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
}

#end-best {
    font: 700 15px/1 "Chakra Petch", ui-sans-serif, system-ui, sans-serif;
    letter-spacing: 0.2em;
    color: #9fd8ff;
    margin-bottom: 8px;
}

#end-best.new-best {
    color: var(--punch);
}

/* The game's tools stay in the bar, with a gap before mute. */
#bar .gap {
    width: 10px;
}

#vol-menu {
    width: 170px;
    padding: 8px 14px;
    align-items: center;
}

/* ?demo, for recording a trailer: no shell. */
body.demo #badge,
body.demo #bar {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    #title-name span, #title-hint, #play-btn, .end-card { animation: none; }
}
