html {
    height: var(--mc-vvh, 100svh);
    max-height: var(--mc-vvh, 100svh);
    overflow: hidden;
    overscroll-behavior: none;
}

body {
    font-family: Arial, sans-serif;
    text-align: center;
    margin: 0;
    background-color: #ffffff;
    color: #000000;
    display: flex;
    flex-direction: column;
    height: var(--mc-vvh, 100svh);
    max-height: var(--mc-vvh, 100svh);
    overflow: hidden;
}

.container {
    position: relative;
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
}

.chrome {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.title-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

.subtitle {
    font-size: 10pt;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 0;
    color: #000000;
}

.title {
    font-family: 'Dancing Script', cursive;
    font-weight: 700;
    color: #000000;
    font-size: 3em;
    margin: 0;
    line-height: 1.1;
}

.top-container {
    display: grid;
    grid-template-columns: repeat(3, 120px);
    column-gap: 15px;
    align-items: stretch;
    width: 390px;
    max-width: 100%;
}

button,
button * {
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

button {
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    touch-action: manipulation;
}

#learn-btn,
#play-btn {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #000000;
}

.btn-icon {
    display: none;
    font-size: 1.15em;
    font-weight: 700;
    line-height: 1;
}

#learn-btn:hover,
#play-btn:hover {
    background-color: #000000;
    color: #ffffff;
}

#play-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.play-icon {
    display: inline-block;
}

.audio-active .play-icon {
    animation: play-pulse-away 0.8s infinite ease-in-out;
}

@keyframes play-pulse-away {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-5px); }
}

#score {
    box-sizing: border-box;
    width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 16px;
    color: #000000;
    background: #ffffff;
    border: 2px solid #000000;
    padding: 8px;
    border-radius: 5px;
}

.scatter {
    position: absolute;
    top: env(safe-area-inset-top, 0px);
    right: env(safe-area-inset-right, 0px);
    bottom: env(safe-area-inset-bottom, 0px);
    left: env(safe-area-inset-left, 0px);
    z-index: 1;
    width: auto;
    margin: 0;
}

.pitch-btn {
    position: absolute;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
    border: none;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
    animation: bob 3.6s ease-in-out infinite;
    animation-delay: var(--delay, 0s);
    transform: rotate(var(--tilt, 0deg));
    scale: 1;
    transition: scale 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scatter.is-ready .pitch-btn {
    transition:
        scale 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
        left 0.85s cubic-bezier(0.4, 0, 0.2, 1),
        top 0.85s cubic-bezier(0.4, 0, 0.2, 1),
        width 0.85s cubic-bezier(0.4, 0, 0.2, 1),
        height 0.85s cubic-bezier(0.4, 0, 0.2, 1),
        font-size 0.85s cubic-bezier(0.4, 0, 0.2, 1),
        background-color 0.85s cubic-bezier(0.4, 0, 0.2, 1),
        color 0.85s cubic-bezier(0.4, 0, 0.2, 1),
        filter 0.85s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.85s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.85s cubic-bezier(0.4, 0, 0.2, 1);
}

.pitch-btn:active {
    scale: 0.94;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.35);
}

@media (hover: hover) and (pointer: fine) {
    .pitch-btn:hover {
        scale: 1.1;
        z-index: 2;
    }
}

.scatter.is-idle .pitch-btn,
.pitch-btn.is-wrong {
    filter: grayscale(1);
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
    box-shadow: none;
}

.color-0 { background-color: #F46C3F; }
.color-1 { background-color: #e36f46; }
.color-2 { background-color: #e3c33b; color: #222; }
.color-3 { background-color: #8BC34A; color: #222; }
.color-4 { background-color: #22b4be; }
.color-5 { background-color: #A7226F; }
.color-6 { background-color: #5B8DEF; }
.color-7 { background-color: #9B59B6; }
.color-8 { background-color: #FF5C8A; }
.color-9 { background-color: #FF8C42; }
.color-10 { background-color: #1D929A; }
.color-11 { background-color: #2ECC71; }

@keyframes bob {
    0%, 100% { transform: rotate(var(--tilt, 0deg)) translateY(0); }
    50% { transform: rotate(var(--tilt, 0deg)) translateY(-8px); }
}

.overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    background: rgba(0, 0, 0, 0.45);
}

.overlay.hidden {
    display: none;
}

.cp-modal {
    position: relative;
    box-sizing: border-box;
    width: min(100%, 20rem);
    padding: 1.5rem 1.35rem 1.25rem;
    border: 2px solid #000000;
    border-radius: 12px;
    background: #ffffff;
    color: #000000;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.cp-modal--result {
    height: 19.5rem;
    display: flex;
    flex-direction: column;
}

.cp-modal__title {
    margin: 0;
    text-align: center;
    font-family: 'Dancing Script', cursive;
    font-size: 2rem;
    font-weight: 700;
    color: #000000;
}

.cp-modal__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.cp-modal__lead,
.cp-modal__notes,
.cp-modal__prompt {
    margin: 0;
    text-align: center;
    font-size: 0.95rem;
    line-height: 1.4;
}

.cp-modal__prompt {
    margin-top: 0.85rem;
}

.cp-modal__answer {
    margin: 0;
    min-height: 2.6em;
    font-size: 1.2rem;
    font-weight: 700;
    color: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.cp-modal__btn {
    display: block;
    width: 100%;
    margin-top: 1rem;
    padding: 0.65rem 0.75rem;
    border: 2px solid #000000;
    border-radius: 5px;
    background: #ffffff;
    color: #000000;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
}

.cp-modal__actions {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    margin-top: 1rem;
}

.cp-modal__actions .cp-modal__btn {
    margin-top: 0;
    flex: 1;
}

.cp-modal__btn--ghost {
    background: #ffffff;
    color: #000000;
    border: 2px solid #000000;
}

.cp-modal__btn:hover {
    background: #000000;
    color: #ffffff;
}

.cp-modal__btn:focus-visible {
    outline: 2px solid #000000;
    outline-offset: 2px;
}

@media screen and (max-width: 767px) {
    .subtitle { font-size: 8pt; }
    .title { font-size: 2em; }
    .title-container { margin-bottom: 16px; }
    .top-container {
        display: flex;
        justify-content: center;
        align-items: stretch;
        gap: 8px;
        width: auto;
        max-width: min(100vw - 40px, 22rem);
    }
    #play-btn,
    #learn-btn {
        flex: 0 0 48px;
        width: 48px;
        min-height: 44px;
        min-width: 44px;
        padding: 8px 0;
        font-size: 18px;
    }
    .btn-label {
        display: none;
    }
    .btn-icon {
        display: inline;
    }
    #score {
        width: auto;
        flex: 0 0 auto;
        min-height: 44px;
        padding: 8px 12px;
        font-size: 15px;
        white-space: nowrap;
    }
    .cp-modal--result { height: 20.5rem; }
    .cp-modal__actions { flex-direction: column; }
    .cp-modal__btn { min-height: 44px; }
}

@media screen and (max-width: 767px) and (max-height: 500px) {
    .title-container { margin-bottom: 8px; }
    .title { font-size: 1.6em; }
    .cp-modal--result { height: 16.5rem; }
}
