@font-face {
    font-family: "Mabook";
    src: url("../fonts/mabook/Mabook.otf") format("opentype");
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
}

:root {
    color-scheme: light;
    background: #fff;
    font-family: "Mabook", sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-width: 280px;
    min-height: 100%;
    margin: 0;
}

body {
    min-height: 100vh;
    min-height: 100svh;
    background: #fff;
}

.game-intro[hidden] {
    display: none;
}

.game-intro {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: 24px;
    background: #fff;
}

.game-intro.is-starting {
    pointer-events: none;
    animation: game-intro-exit 820ms cubic-bezier(0.76, 0, 0.24, 1) both;
}

.game-intro__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    text-align: center;
}

.game-intro__title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(4px, 1.2vh, 12px);
    margin: 0;
    color: #171717;
    font-weight: 700;
    line-height: 0.9;
}

.game-intro__title-line {
    display: inline-block;
    width: max-content;
    max-width: none;
    white-space: nowrap;
    font-size: clamp(48px, 12vw, 120px);
    letter-spacing: 0;
}

.game-intro__start {
    min-height: 48px;
    margin-top: clamp(42px, 8vh, 88px);
    padding: 8px 14px;
    border: 0;
    background: transparent;
    color: #171717;
    font: inherit;
    font-size: clamp(18px, 3vw, 24px);
    cursor: pointer;
    animation: game-start-nudge 1.6s ease-in-out infinite;
}

.game-intro__start:hover {
    text-decoration: underline;
    text-underline-offset: 5px;
}

.game-intro__start:focus-visible {
    outline: 2px dashed #171717;
    outline-offset: 4px;
}

@keyframes game-intro-exit {
    to {
        transform: translateY(-105%);
    }
}

@keyframes game-start-nudge {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

.stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(12px, 2vh, 22px);
    min-height: 100vh;
    min-height: 100svh;
    overflow: hidden;
    padding: 24px;
}

.cat-scene {
    position: relative;
    width: min(560px, 100%);
    animation: breathe 3.6s ease-in-out infinite;
    will-change: transform;
}

.cat {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: auto;
    transition: opacity 160ms ease;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-drag: none;
}

.cat:active {
    cursor: grabbing;
}

.cat.is-transitioning {
    opacity: 0;
}

.envelope-button {
    position: absolute;
    z-index: 2;
    top: 56%;
    left: 52%;
    width: 25%;
    height: 21%;
    display: grid;
    place-items: center;
    padding: 0;
    transform: translate(-50%, -50%);
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}

.envelope-button__icon {
    display: grid;
    width: clamp(36px, 6vw, 46px);
    aspect-ratio: 1;
    place-items: center;
    border: 1px solid rgba(35, 35, 35, 0.18);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.88);
    color: #222;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.13);
    transition: transform 180ms ease, background-color 180ms ease;
}

.envelope-button:hover .envelope-button__icon {
    transform: scale(1.1);
    background: #fff;
}

.envelope-button__icon svg {
    width: 52%;
    height: 52%;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.envelope-button[hidden] {
    display: none;
}

.envelope-button:focus-visible {
    outline: 2px dashed #333;
    outline-offset: 3px;
}

.letter-slider-label[hidden],
.letter-slider[hidden] {
    display: none;
}

.letter-slider-label {
    position: absolute;
    z-index: 4;
    top: 15%;
    left: 50%;
    width: max-content;
    max-width: calc(100vw - 32px);
    transform: translateX(-50%);
    color: #171717;
    display: grid;
    gap: 4px;
    font-size: clamp(14px, 2.2vw, 19px);
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
}

.cat-scene.is-envelope-open .letter-slider-label {
    top: 0%;
}

.letter-slider {
    position: absolute;
    z-index: 3;
    top: 35%;
    left: 50%;
    width: 54px;
    height: 25%;
    transform: translateX(-50%);
    cursor: ns-resize;
    touch-action: none;
    user-select: none;
}

.letter-slider__track {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 42px;
    transform: translateX(-50%);
    border: 2px solid rgba(25, 25, 25, 0.24);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.12);
}

.letter-slider__thumb {
    position: absolute;
    top: calc(100% - 18px);
    left: 50%;
    width: 36px;
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(25, 25, 25, 0.28);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2), 0 0 0 3px rgba(255, 255, 255, 0.6);
    animation: slider-nudge-up 1.25s ease-in-out infinite;
    transition: background-color 140ms ease, box-shadow 140ms ease;
    pointer-events: none;
}

.letter-slider:active .letter-slider__thumb {
    animation-play-state: paused;
}

.letter-slider:hover .letter-slider__thumb {
    background: rgba(255, 255, 255, 0.96);
}

.letter-slider:focus-visible {
    outline: none;
}

.letter-slider:focus-visible .letter-slider__thumb {
    outline: 2px solid rgba(25, 25, 25, 0.5);
    outline-offset: 3px;
}

.letter-slider.is-disabled {
    cursor: default;
    pointer-events: none;
}

.letter-slider.is-disabled .letter-slider__thumb {
    opacity: 0.45;
    animation: none;
}

@keyframes slider-nudge-up {
    0%,
    100% {
        transform: translate(-50%, -50%);
    }

    55% {
        transform: translate(-50%, -50%) translateY(-9px);
    }
}

.letter-pages[hidden] {
    display: none;
}

.letter-pages {
    position: absolute;
    z-index: 5;
    inset: 0;
    color: #171717;
    touch-action: none;
    user-select: none;
}

.cat-scene.is-letter-open .cat,
.cat-scene.is-letter-open .letter-pages {
    transform: rotate(0.55deg);
    transform-origin: center;
}

.cat-scene.is-letter-open .cat {
    visibility: hidden;
}

.letter-pages__hint {
    position: absolute;
    z-index: 5;
    top: -10%;
    left: 50%;
    display: grid;
    width: max-content;
    max-width: 90%;
    gap: 4px;
    margin: 0;
    transform: translateX(-50%);
    color: #171717;
    font-size: clamp(13px, 1.8vw, 18px);
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    pointer-events: none;
}

.letter-pages__hint--last {
    display: none;
    top: auto;
    bottom: calc(100% + 12px);
}

.letter-pages.is-last-letter-page .letter-pages__hint--default {
    display: none;
}

.letter-pages.is-last-letter-page .letter-pages__hint--last {
    display: grid;
    animation: final-hint-enter 320ms ease-out both;
}

.letter-pages__swipe-cue {
    display: block;
    width: 34px;
    height: 34px;
    margin: 2px auto 0;
    animation: letter-swipe-left 1.7s ease-in-out infinite;
}

.letter-pages__swipe-cue img {
    display: block;
    width: 100%;
    height: 100%;
}

@keyframes letter-swipe-left {
    0%, 12% {
        opacity: 0;
        transform: translateX(30px);
    }

    30%, 70% {
        opacity: 1;
    }

    82%, 100% {
        opacity: 0;
        transform: translateX(-30px);
    }
}

.letter-pages.is-birthday-active .letter-pages__hint {
    visibility: hidden;
}

.letter-pages.is-final-reveal .letter-pages__hint--last {
    animation: final-hint-exit 300ms ease-in both;
}

.letter-pages.is-final-return .birthday-finale__title {
    animation: final-hint-exit 300ms ease-in both;
}

.letter-sheet.is-throwing-left {
    animation: paper-throw-left 440ms cubic-bezier(0.55, 0, 0.9, 0.4) both;
}

.letter-sheet.is-throwing-left.is-final-throw {
    animation: paper-finale-throw-left 760ms cubic-bezier(0.36, 0, 0.3, 1) both;
}

.letter-sheet.is-throwing-right {
    animation: paper-throw-right 440ms cubic-bezier(0.55, 0, 0.9, 0.4) both;
}

.letter-sheet.is-entering-left {
    animation: paper-enter-left 440ms cubic-bezier(0.16, 0.75, 0.25, 1) both;
}

.letter-sheet[hidden] {
    display: none;
}

.letter-sheet {
    position: absolute;
    z-index: 1;
    inset: 0;
    background: url("../images/photos/envelope_text.png") center / 100% 100% no-repeat;
    transform-origin: center;
}

.letter-sheet.is-front {
    z-index: 3;
    transform: rotate(0.55deg);
}

.letter-sheet.is-front.is-entering-left {
    z-index: 4;
}

.letter-sheet.is-back-1,
.letter-sheet.is-back-2,
.letter-sheet.is-back-3 {
    pointer-events: none;
}

.letter-sheet.is-back-1 {
    z-index: 2;
    transform: rotate(-2.8deg) translate(-1.6%, -1.2%) scale(0.985);
}

.letter-sheet.is-back-2 {
    z-index: 1;
    transform: rotate(2.2deg) translate(1.6%, 1.2%) scale(0.98);
}

.letter-sheet.is-back-3 {
    z-index: 0;
    transform: rotate(-1.4deg) translate(-2.2%, 1.8%) scale(0.97);
}

.letter-sheet--birthday {
    background: #fff;
    will-change: transform, opacity;
}

.letter-sheet--birthday.is-revealing-birthday {
    z-index: 2;
    animation: birthday-scene-reveal 900ms cubic-bezier(0.45, 0, 0.3, 1) both;
}

.letter-sheet--birthday.is-front {
    transform: none;
}

.birthday-finale__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.birthday-finale__title {
    position: absolute;
    top: -10%;
    left: 50%;
    display: none;
    width: max-content;
    max-width: 90%;
    margin: 0;
    transform: translateX(-50%);
    font-size: clamp(18px, 2.6vw, 26px);
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    pointer-events: none;
}

.letter-sheet--birthday.is-revealing-birthday .birthday-finale__title,
.letter-pages.is-birthday-active .birthday-finale__title {
    display: block;
}

.birthday-finale__replay {
    position: absolute;
    z-index: 6;
    bottom: -13%;
    left: 50%;
    width: max-content;
    max-width: min(92vw, 420px);
    padding: 9px 14px;
    transform: translateX(-50%);
    border: 2px solid #171717;
    border-radius: 999px;
    background: #fff;
    color: #171717;
    font: inherit;
    font-size: clamp(14px, 2vw, 18px);
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 3px 0 #171717;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.birthday-finale__replay:hover {
    transform: translate(-50%, -2px);
    box-shadow: 0 5px 0 #171717;
}

.birthday-finale__replay:active {
    transform: translate(-50%, 1px);
    box-shadow: 0 1px 0 #171717;
}

.birthday-finale__replay:focus-visible {
    outline: 3px dashed #171717;
    outline-offset: 4px;
}

.birthday-finale__replay[hidden],
.end-credits[hidden] {
    display: none;
}

.letter-pages.is-birthday-active .birthday-finale__replay {
    animation: birthday-replay-enter 420ms 380ms ease-out both;
}

@keyframes birthday-replay-enter {
    from {
        opacity: 0;
        translate: 0 8px;
    }

    to {
        opacity: 1;
        translate: 0 0;
    }
}

.end-credits {
    position: fixed;
    z-index: 120;
    inset: 0;
    display: grid;
    overflow: auto;
    place-items: start center;
    padding: 0 24px;
    background: #fff;
    color: #171717;
    text-align: center;
    overscroll-behavior: contain;
}

.end-credits__crawl {
    width: min(100%, 620px);
    padding: 18vh 0 16vh;
    opacity: 0;
}

.end-credits__crawl.is-running {
    animation: end-credits-roll 23s linear both;
}

.end-credits__eyebrow {
    margin: 0 0 8px;
    font-size: clamp(14px, 2vw, 18px);
    letter-spacing: 0.14em;
}

.end-credits h2 {
    margin: 0 0 38px;
    font-size: clamp(32px, 7vw, 54px);
}

.end-credits__list {
    display: grid;
    gap: 22px;
    margin: 0;
}

.end-credits__list div {
    display: grid;
    gap: 4px;
}

.end-credits__list dt {
    font-size: clamp(16px, 2.5vw, 21px);
    font-weight: 700;
}

.end-credits__list dd {
    margin: 0;
    font-size: clamp(15px, 2.3vw, 19px);
}

.end-credits__thanks {
    margin: 54px 0 0;
    font-size: clamp(20px, 4vw, 28px);
    font-weight: 700;
}

@keyframes end-credits-roll {
    from {
        opacity: 1;
        transform: translateY(100vh);
    }

    to {
        opacity: 1;
        transform: translateY(-100%);
    }
}

@keyframes birthday-scene-reveal {
    from {
        opacity: 0;
        transform: scale(0.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes final-hint-exit {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes final-hint-enter {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes paper-finale-throw-left {
    from {
        transform: rotate(0.55deg) translate(0, 0);
    }

    to {
        transform: rotate(-13deg) translate(-140%, -7%);
    }
}

.letter-page {
    position: absolute;
    top: 11%;
    left: 18%;
    width: 64%;
    height: 68%;
    overflow: hidden;
    font-size: clamp(12px, 1.95vw, 16px);
    line-height: 1.62;
}

.letter-page p {
    margin: 0 0 1.1em;
}

.letter-page__address {
    font-size: 0.9em;
    line-height: 1.3;
}

.letter-page h2 {
    margin: 0 0 0.65em;
    font-size: 1.18em;
    line-height: 1.25;
}

.letter-sheet__indicator {
    position: absolute;
    z-index: 5;
    bottom: 10%;
    left: 18%;
    color: rgba(23, 23, 23, 0.7);
    font-size: clamp(11px, 1.6vw, 13px);
    line-height: 1;
}

/* Keep the slider track and handle centered as one custom control. */
.sulk-message[hidden],
.lookback-message[hidden] {
    display: none;
}

.sulk-message,
.lookback-message {
    position: absolute;
    bottom: calc(100% + 14px);
    left: 50%;
    width: max-content;
    max-width: calc(100vw - 36px);
    margin: 0;
    transform: translateX(-50%);
    color: #171717;
    font-size: clamp(14px, 2.2vw, 19px);
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
}

.nudge-button {
    position: absolute;
    z-index: 2;
    top: 51%;
    display: grid;
    width: clamp(38px, 8vw, 50px);
    aspect-ratio: 1;
    place-items: center;
    padding: 0;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(35, 35, 35, 0.14);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.66);
    color: rgba(35, 35, 35, 0.72);
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    cursor: pointer;
    animation: nudge-hint 2.2s ease-out infinite;
    transition: opacity 180ms ease, transform 180ms ease, background-color 180ms ease;
}

.nudge-button--right {
    left: 37%;
}

.nudge-button--left {
    left: 63%;
}

.nudge-button--belly {
    top: 70%;
    left: 50%;
}

.nudge-button--head {
    top: 23%;
    left: 36%;
}

.nudge-button[hidden] {
    display: none;
}

.nudge-button svg {
    width: 48%;
    height: 48%;
    fill: currentColor;
}

.nudge-button:hover {
    transform: translate(-50%, -50%) scale(1.1);
    background: rgba(255, 255, 255, 0.9);
}

.nudge-button:focus-visible {
    outline: 3px solid rgba(35, 35, 35, 0.52);
    outline-offset: 4px;
}

.nudge-button.is-used {
    opacity: 0;
    pointer-events: none;
}

.nudge-button.is-cooling {
    animation: none;
    opacity: 0.45;
    pointer-events: none;
}

.meter-stack {
    position: relative;
    z-index: 2;
    width: min(420px, 100%);
    display: grid;
    gap: 9px;
    margin-inline: auto;
}

.meter-stack[hidden] {
    display: none;
}

.puzzle-controls[hidden] {
    display: none;
}

.puzzle-controls {
    display: grid;
    justify-items: center;
    gap: 7px;
    padding-block: 2px;
}

.cooldown-meter[hidden] {
    display: none;
}

.swipe-meter[hidden] {
    display: none;
}

.swipe-meter {
    margin-bottom: 8px;
}

.mood-label {
    margin: 0;
    color: #111;
    font-size: 15px;
    line-height: 1.2;
    text-align: center;
}

.letter-ready-message {
    margin: 0;
    color: #171717;
    font-size: clamp(16px, 2.2vw, 19px);
    font-weight: 700;
    line-height: 1.45;
    text-align: center;
}

.letter-ready-message[hidden] {
    display: none;
}

.cooldown-meter {
    position: absolute;
    z-index: 4;
    top: -42px;
    left: 50%;
    width: min(420px, 100%);
    transform: translateX(-50%);
    color: #111;
    font-size: 12px;
    font-weight: 600;
}

.cooldown-meter__heading {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.cooldown-meter__track {
    height: 10px;
    padding: 1px;
    overflow: hidden;
    border: 1px solid #111;
    border-radius: 99px;
    background: #fff;
}

.cooldown-meter__fill {
    display: block;
    width: 100%;
    height: 100%;
    border: 1px solid #fff;
    border-radius: inherit;
    background: #3787d8;
}

.swipe-meter__fill {
    display: block;
    width: 0;
    height: 100%;
    border: 1px solid #fff;
    border-radius: inherit;
    background: #111;
    transition: width 80ms linear;
}

.swipe-meter__percent {
    font-variant-numeric: tabular-nums;
}

.letter-puzzle[hidden] {
    display: none;
}

.letter-puzzle {
    position: fixed;
    z-index: 4;
    inset: 0;
    pointer-events: none;
}

.letter-puzzle__hint,
.letter-puzzle__status {
    position: absolute;
    left: 50%;
    width: max-content;
    max-width: calc(100vw - 32px);
    margin: 0;
    transform: translateX(-50%);
    color: #222;
    font-size: 14px;
    text-align: center;
}

.letter-puzzle__hint {
    top: 13%;
    padding: 8px 13px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
}

.letter-puzzle__status {
    position: static;
    width: auto;
    max-width: 100%;
    transform: none;
    color: #333;
    font-size: 13px;
    line-height: 1.25;
}

.letter-puzzle__pieces {
    position: absolute;
    inset: 0;
}

.letter-piece {
    position: absolute;
    left: var(--x);
    top: var(--y);
    display: grid;
    min-width: 32px;
    min-height: 42px;
    place-items: center;
    padding: 2px;
    transform: translate(-50%, -50%);
    border: 0;
    background: transparent;
    color: #171717;
    font: inherit;
    font-size: clamp(34px, 5vw, 52px);
    font-weight: 700;
    cursor: pointer;
    pointer-events: auto;
    animation: letter-float var(--duration, 3.8s) ease-in-out var(--delay, 0s) infinite;
    transition: opacity 220ms ease, scale 220ms ease, color 180ms ease;
}

.letter-piece:hover {
    color: #666;
    scale: 1.12;
}

.letter-piece:focus-visible {
    border-radius: 4px;
    outline: 2px dashed #333;
    outline-offset: 5px;
}

.letter-piece.is-wrong {
    color: #e32636;
    animation-name: letter-wrong;
    animation-duration: 260ms;
    animation-timing-function: ease-in-out;
    animation-iteration-count: 1;
}

.letter-piece:disabled {
    cursor: default;
}

.letter-piece.is-collected {
    opacity: 0;
    pointer-events: none;
    scale: 0.55;
    animation-play-state: paused;
}

.letter-piece--s {
    --x: 20%;
    --y: 42%;
    --delay: -0.6s;
    --duration: 4.1s;
    animation-name: letter-drift-s;
}

.letter-piece--o {
    --x: 80%;
    --y: 34%;
    --duration: 4.7s;
    --delay: -2s;
    animation-name: letter-drift-o;
}

.letter-piece--r-one {
    --x: 22%;
    --y: 69%;
    --duration: 3.9s;
    --delay: -1.4s;
    animation-name: letter-drift-r-one;
}

.letter-piece--r-two {
    --x: 78%;
    --y: 68%;
    --duration: 4.4s;
    --delay: -2.5s;
    animation-name: letter-drift-r-two;
}

.letter-piece--y {
    --x: 24%;
    --y: 30%;
    --duration: 5s;
    --delay: -1s;
    animation-name: letter-drift-y;
}

.letter-slot:not(:empty) {
    border-style: solid;
    border-color: #222;
}

.letter-puzzle__answer {
    display: flex;
    justify-content: center;
    gap: clamp(8px, 2vw, 14px);
}

.letter-slot {
    display: grid;
    width: clamp(38px, 9vw, 48px);
    aspect-ratio: 1;
    place-items: center;
    border: 1px dashed #777;
    border-radius: 12px;
    color: #111;
    font-size: 20px;
    font-weight: 700;
}

.letter-slot:not(:empty) {
    border-style: solid;
    border-color: #222;
}

.emotion-meter {
    position: relative;
    height: 16px;
    margin-top: 5px;
    padding: 2px;
    overflow: visible;
    border: 2px solid #111;
    border-radius: 99px;
    background: #fff;
}

.emotion-meter__fill {
    position: relative;
    display: block;
    height: 100%;
    min-width: 0;
    border: 1px solid #fff;
    border-radius: 99px;
    background: #56a96a;
    transition: width 500ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.emotion-meter.is-unimpressed .emotion-meter__fill {
    background: #edc94b;
}

.emotion-meter.is-annoyed .emotion-meter__fill {
    background: #ee9138;
}

.emotion-meter.is-angry .emotion-meter__fill,
.emotion-meter.is-over .emotion-meter__fill {
    background: #e32636;
}

.emotion-meter.is-calm {
    --mood-glow-rgb: 86, 169, 106;
}

.emotion-meter.is-unimpressed {
    --mood-glow-rgb: 237, 201, 75;
}

.emotion-meter.is-annoyed {
    --mood-glow-rgb: 238, 145, 56;
}

.emotion-meter.is-angry {
    --mood-glow-rgb: 227, 38, 54;
}

.emotion-meter:not(.is-over) .emotion-meter__fill {
    box-shadow: 0 0 5px 1px rgba(var(--mood-glow-rgb), 0.48);
    animation: mood-fill-glow 2s ease-in-out infinite;
}

.emotion-meter.is-over .emotion-meter__fill {
    background: #a70f1d;
    box-shadow: 0 0 5px 1px rgba(167, 15, 29, 0.62);
    animation: anger-glow 1.35s ease-in-out infinite;
}

.emotion-meter.is-calm .emotion-meter__marker {
    border-color: #56a96a;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #56a96a;
}

.emotion-meter.is-unimpressed .emotion-meter__marker {
    border-color: #edc94b;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #edc94b;
}

.emotion-meter.is-annoyed .emotion-meter__marker {
    border-color: #ee9138;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #ee9138;
}

.emotion-meter.is-angry .emotion-meter__marker {
    border-color: #e32636;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #e32636;
}

.emotion-meter__marker {
    position: absolute;
    top: 50%;
    right: -16px;
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    transform: translateY(-50%);
    border: 1.5px solid #171717;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

.emotion-meter__icon {
    display: block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
}

.emotion-meter.is-over .emotion-meter__marker {
    border-color: #a70f1d;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #a70f1d, 0 0 12px 4px rgba(167, 15, 29, 0.42);
    animation: anger-marker-glow 1.35s ease-in-out infinite;
}

.emotion-meter.is-reveal-burst {
    animation: mood-reveal-burst 850ms cubic-bezier(0.16, 0.8, 0.28, 1) both;
}

.emotion-meter.is-reveal-burst .emotion-meter__marker {
    animation: mood-marker-burst 850ms cubic-bezier(0.16, 0.8, 0.28, 1) both;
}

@keyframes mood-fill-glow {
    0%,
    100% {
        box-shadow: 0 0 4px 1px rgba(var(--mood-glow-rgb), 0.4);
    }

    50% {
        box-shadow: 0 0 9px 3px rgba(var(--mood-glow-rgb), 0.72);
    }
}

@keyframes mood-reveal-burst {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(var(--mood-glow-rgb), 0);
    }

    22% {
        box-shadow: 0 0 12px 5px rgba(var(--mood-glow-rgb), 0.8), 0 0 28px 12px rgba(var(--mood-glow-rgb), 0.28);
    }

    52% {
        box-shadow: 0 0 20px 9px rgba(var(--mood-glow-rgb), 0.62), 0 0 42px 20px rgba(var(--mood-glow-rgb), 0.18);
    }
}

@keyframes mood-marker-burst {
    0%,
    100% {
        transform: translateY(-50%) scale(1);
    }

    35% {
        transform: translateY(-50%) scale(1.42);
    }
}

@keyframes anger-glow {
    0%,
    100% {
        box-shadow: 0 0 4px 1px rgba(167, 15, 29, 0.5);
    }

    50% {
        box-shadow: 0 0 11px 4px rgba(167, 15, 29, 0.82);
    }
}

@keyframes anger-marker-glow {
    0%,
    100% {
        box-shadow: 0 0 0 2px #fff, 0 0 0 3px #a70f1d, 0 0 8px 2px rgba(167, 15, 29, 0.34);
    }

    50% {
        box-shadow: 0 0 0 2px #fff, 0 0 0 3px #a70f1d, 0 0 15px 5px rgba(167, 15, 29, 0.62);
    }
}

@keyframes breathe {
    0%,
    100% {
        transform: scale(0.975);
    }

    50% {
        transform: scale(1.025);
    }
}

@keyframes paper-throw-left {
    0% {
        transform: rotate(0.55deg) translate(0, 0);
    }

    100% {
        transform: rotate(-13deg) translate(-105%, -7%);
    }
}

@keyframes paper-throw-right {
    0% {
        transform: rotate(0.55deg) translate(0, 0);
    }

    100% {
        transform: rotate(13deg) translate(105%, -7%);
    }
}

@keyframes paper-enter-left {
    0% {
        transform: rotate(-13deg) translate(-105%, -7%);
    }

    100% {
        transform: rotate(0.55deg) translate(0, 0);
    }
}

@keyframes nudge-hint {
    0%,
    100% {
        box-shadow: 0 3px 14px rgba(0, 0, 0, 0.1), 0 0 0 0 rgba(80, 80, 80, 0.14);
    }

    50% {
        box-shadow: 0 3px 14px rgba(0, 0, 0, 0.1), 0 0 0 8px rgba(80, 80, 80, 0);
    }
}

@keyframes letter-float {
    0%,
    100% {
        translate: 0 0;
    }

    50% {
        translate: 0 -10px;
    }
}

@keyframes letter-drift-s {
    0%,
    100% {
        translate: 0 0;
        rotate: 0deg;
    }

    22% {
        translate: 15px -12px;
        rotate: 5deg;
    }

    53% {
        translate: -10px 13px;
        rotate: -4deg;
    }

    78% {
        translate: 13px 7px;
        rotate: 3deg;
    }
}

@keyframes letter-drift-o {
    0%,
    100% {
        translate: 0 0;
        rotate: 0deg;
    }

    27% {
        translate: -17px 10px;
        rotate: -5deg;
    }

    61% {
        translate: 10px -16px;
        rotate: 4deg;
    }

    82% {
        translate: -7px -8px;
        rotate: -3deg;
    }
}

@keyframes letter-drift-r-one {
    0%,
    100% {
        translate: 0 0;
        rotate: 0deg;
    }

    19% {
        translate: -12px -14px;
        rotate: -4deg;
    }

    47% {
        translate: 16px -5px;
        rotate: 6deg;
    }

    73% {
        translate: -8px 15px;
        rotate: -5deg;
    }
}

@keyframes letter-drift-r-two {
    0%,
    100% {
        translate: 0 0;
        rotate: 0deg;
    }

    24% {
        translate: 14px 13px;
        rotate: 5deg;
    }

    51% {
        translate: -16px 4px;
        rotate: -6deg;
    }

    79% {
        translate: 7px -15px;
        rotate: 3deg;
    }
}

@keyframes letter-drift-y {
    0%,
    100% {
        translate: 0 0;
        rotate: 0deg;
    }

    20% {
        translate: 12px 15px;
        rotate: 4deg;
    }

    49% {
        translate: -16px 8px;
        rotate: -5deg;
    }

    76% {
        translate: 8px -13px;
        rotate: 3deg;
    }
}

@keyframes letter-wrong {
    0%,
    100% {
        translate: 0 0;
    }

    30% {
        translate: -5px 0;
    }

    70% {
        translate: 5px 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .game-intro.is-starting,
    .game-intro__start,
    .letter-pages.is-birthday-active .birthday-finale__replay {
        animation: none;
    }
    .end-credits__crawl.is-running {
        animation-duration: 8s;
    }
    .letter-sheet--birthday.is-revealing-birthday,
    .letter-pages.is-final-reveal .letter-pages__hint--last,
    .letter-pages.is-final-return .birthday-finale__title,
    .letter-pages.is-last-letter-page .letter-pages__hint--last {
        animation: none;
    }
    .letter-pages__swipe-cue {
        animation: none;
    }
    .cat-scene {
        animation: none;
    }

    .nudge-button {
        animation: none;
    }

    .emotion-meter__fill {
        transition: none;
    }

    .emotion-meter.is-over .emotion-meter__fill,
    .emotion-meter.is-over .emotion-meter__marker,
    .emotion-meter:not(.is-over) .emotion-meter__fill,
    .emotion-meter.is-reveal-burst,
    .emotion-meter.is-reveal-burst .emotion-meter__marker {
        animation: none;
    }

    .letter-piece {
        animation: none;
    }

    .letter-slider__thumb {
        animation: none;
    }
}

@media (max-width: 600px) {
    .cat-scene.is-letter-open .letter-sheet:not(.letter-sheet--birthday) {
        scale: 1.13;
    }

    .letter-pages__hint--default {
        top: -20%;
    }

    .letter-page {
        font-size: clamp(11.5px, 2.9vw, 13px);
        line-height: 1.48;
    }

    .emotion-meter {
        width: 82%;
        margin-inline: auto;
    }

    .cooldown-meter__track {
        width: 82%;
        margin-inline: auto;
    }

    .cooldown-meter__heading {
        width: 82%;
        margin-inline: auto;
    }
}
