/* 画面・ボタン・通知のアニメーションとトランジション。 */
.button,
.selector {
    transition:
        border-color 150ms ease-in-out,
        color 150ms ease-in-out;
}

:is(.button, .selector)::before {
    transition: opacity 100ms ease-in-out;
}

:is(:is(.button, .selector):focus)::before {
    transition: opacity 200ms ease-in-out;
}

#replay .options .replayDataContainer .replaySaveButton::before {
    transition: opacity 200ms;
}

#savedReplay .options .replayDataContainer .replayDeleteButton::before {
    transition: opacity 200ms;
}

#graphicSetting .options .button {
    transition: color 100ms ease-in-out;
}

@keyframes shake {
    0% {
        transform: translateX(0cqh);
    }
    25% {
        transform: translateX(0.2cqh);
    }
    50% {
        transform: translateX(0cqh);
    }
    75% {
        transform: translateX(-0.2cqh);
    }
    100% {
        transform: translateX(0cqh);
    }
}

.flickering {
    animation-duration: 1s !important;
    animation-timing-function: ease-in-out !important;
    animation-delay: 0 !important;
    animation-direction: normal !important;
    animation-iteration-count: infinite !important;
    animation-name: flickering !important;
}

@keyframes flickering {
    0% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(2);
    }
    100% {
        filter: brightness(1);
    }
}

#startEffectBase {
    transition-duration: 250ms;
    transition-property: background-color, border;
}

.startEffectLabel {
    animation-direction: normal;
    animation-duration: 500ms;
    animation-name: startEffectAnimation;
    animation-timing-function: ease-out;
    animation-fill-mode: forwards;
}

#startLabel {
    animation-direction: normal;
    animation-duration: 500ms;
    animation-name: startLabelAnimation;
    animation-timing-function: ease-out;
    animation-fill-mode: forwards;
}

@keyframes startEffectBaseAnimation {
    0% {
        transform: translate3d(0, 0, -20cqh);
    }
    50% {
        transform: translate3d(0, 0, 0);
    }
    70% {
        transform: translate3d(0, 0, 10cqh);
    }
    100% {
        transform: translate3d(0, 0, 0);
    }
}

@keyframes startEffectAnimation {
    0% {
        transform: translate3d(0, -50cqh, -20cqh);
        opacity: 0;
        filter: blur(0.5cqh);
    }
    30% {
        rotate: 0deg;
        transform: translate3d(0, 0, 0);
        filter: blur(0cqh);
        opacity: 1;
    }
    70% {
        rotate: 0deg;
        transform: translate3d(0, 0, 0);
        opacity: 1;
        filter: blur(0cqh);
    }
    100% {
        transform: translate3d(0, 50cqh, -40cqh);
        filter: blur(0.5cqh);
        opacity: 0;
    }
}

@keyframes startLabelAnimation {
    0% {
        transform: perspective(30cqh) translate3d(0, -50cqh, -10cqh);
        opacity: 0;
    }
    30% {
        transform: perspective(30cqh) translate3d(0, 0, 10cqh);
        opacity: 1;
    }
    60% {
        transform: perspective(30cqh) translate3d(0, 0, 10cqh);
        filter: blur(0cqh);
        opacity: 1;
    }
    100% {
        transform: perspective(30cqh) translate3d(0, 0, 20cqh);
        filter: blur(2cqh);
        opacity: 0;
    }
}

.button:focus,
.selector:focus {
    animation-direction: normal;
    animation-duration: 250ms;
    animation-name: touchVibration;
    animation-timing-function: ease-in;
    animation-fill-mode: forwards;
}

@keyframes touchVibration {
    0% {
        transform: translate(0cqh);
    }
    20% {
        transform: translate(-0.7cqh);
    }
    40% {
        transform: translate(0.7cqh);
    }
    60% {
        transform: translate(-0.4cqh);
    }
    80% {
        transform: translate(0.3cqh);
    }
    100% {
        transform: translate(0cqh);
    }
}

.headingLabel {
    animation-direction: normal;
    animation-duration: 400ms;
    animation-name: rightFadeIn;
    animation-timing-function: ease-in-out;
    animation-fill-mode: forwards;
}

@keyframes rightFadeIn {
    0% {
        transform: translate(10cqh);
        filter: blur(0.5cqh);
        opacity: 0;
    }
    100% {
        transform: translate(0cqh);
        filter: blur(0cqh);
        opacity: 1;
    }
}

#startEffectBase {
    animation-direction: normal;
    animation-duration: 500ms;
    animation-name: leftFadeIn;
    animation-timing-function: ease-in-out;
    animation-fill-mode: forwards;
}

@keyframes leftFadeIn {
    0% {
        transform: translate(-10cqh);
        filter: blur(0.5cqh);
        opacity: 0;
    }
    100% {
        transform: translate(0cqh);
        filter: blur(0cqh);
        opacity: 1;
    }
}

.selectOptionDescriptions * {
    animation-direction: normal;
    animation-duration: 400ms;
    animation-timing-function: ease-out;
    animation-fill-mode: forwards;
    animation-name: none;
}

.selectOptionDescriptions > div {
    animation:
        descriptionAppear 240ms ease-out both,
        descriptionFloat 4s ease-in-out 240ms infinite;
}

@keyframes descriptionFloat {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-0.8cqh);
    }
}

@keyframes descriptionAppear {
    from {
        opacity: 0;
        transform: translateX(1.5cqh);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .selectOptionDescriptions > div {
        animation: descriptionFade 120ms ease-out both;
    }
}

@keyframes descriptionFade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.playCanvas {
    transition: background-color 240ms ease-out;
}

.reducedPlayMotion .playCanvas {
    transition: none;
}

.feedbackMessage {
    animation: feedbackAppear var(--feedback-duration, 200ms) ease-out;
}

.feedbackPaused .feedbackMessage {
    animation-play-state: paused;
}

.reducedPlayMotion .feedbackMessage {
    animation: none;
}

#replayControls,
#replayControls.disabled {
    transition:
        opacity 250ms ease-out,
        visibility 250ms;
}

@keyframes feedbackAppear {
    from {
        opacity: 0;
        transform: translateY(0.5cqh);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
