* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'MedievalSharp', cursive;
}

body {
    background: #0a0a0f;
    color: #ffffff;
}

.screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 15vh 0 8vh 0;
    background: radial-gradient(ellipse at 50% 80%, #1a1a2e 0%, #0a0a0f 60%);
    position: relative;
}

.cube-container {
    margin-top: 8vh;
    perspective: 600px;
    width: 80px;
    height: 80px;
}

.cube {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    animation: rotateCube 6s linear infinite;
}

.cube-face {
    position: absolute;
    width: 80px;
    height: 80px;
    background: url('../img/button.png') center/contain no-repeat;
    border: 1px solid rgba(120, 80, 200, 0.2);
    opacity: 0.8;
}

.cube-front  { transform: rotateY(0deg) translateZ(40px); }
.cube-back   { transform: rotateY(180deg) translateZ(40px); }
.cube-right  { transform: rotateY(90deg) translateZ(40px); }
.cube-left   { transform: rotateY(-90deg) translateZ(40px); }
.cube-top    { transform: rotateX(90deg) translateZ(40px); }
.cube-bottom { transform: rotateX(-90deg) translateZ(40px); }

@keyframes rotateCube {
    0% {
        transform: rotateX(-20deg) rotateY(0deg);
    }
    100% {
        transform: rotateX(-20deg) rotateY(360deg);
    }
}

.page-title {
    font-family: 'MedievalSharp', cursive;
    font-size: 3rem;
    color: rgba(200, 160, 255, 0.8);
    text-align: center;
    margin-top: 8vh;
    letter-spacing: 0.05em;
}

.page-subtitle {
    font-size: 0.55em;
    opacity: 0.6;
    display: block;
    margin-top: 0.2em;
}

.sound-indicator {
    font-size: 1.2rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    text-align: center;
    padding: 0 2rem;
    min-height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sound-indicator.active {
    opacity: 1;
    animation: sparkle 0.6s ease-in-out infinite alternate;
}

@keyframes sparkle {
    0% {
        text-shadow: 0 0 5px rgba(200, 160, 255, 0.4), 0 0 10px rgba(200, 160, 255, 0.2);
    }
    100% {
        text-shadow: 0 0 15px rgba(200, 160, 255, 0.8), 0 0 30px rgba(200, 160, 255, 0.4), 0 0 45px rgba(200, 160, 255, 0.2);
    }
}

.button-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.replay-button {
    position: fixed;
    bottom: 12vh;
    left: 50%;
    transform: translateX(calc(-50% - 120px));
    width: min(14vw, 56px);
    height: min(14vw, 56px);
    border-radius: 50%;
    border: 2px solid rgba(120, 80, 200, 0.3);
    background: rgba(42, 26, 62, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, opacity 0.3s ease;
    -webkit-touch-callout: none;
    opacity: 0;
    pointer-events: none;
}

.replay-button.visible {
    opacity: 1;
    pointer-events: auto;
}

.replay-button:active {
    transform: translateX(calc(-50% - 120px)) scale(0.9);
    background: rgba(42, 26, 62, 0.9);
}

.replay-button svg {
    width: 45%;
    height: 45%;
    color: rgba(200, 160, 255, 0.8);
}

.music-button {
    width: min(45vw, 180px);
    height: min(45vw, 180px);
    border-radius: 50%;
    border: none;
    background: url('../img/button.png') center/contain no-repeat;
    box-shadow:
        0 0 40px rgba(120, 80, 200, 0.15),
        0 10px 30px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    -webkit-touch-callout: none;
}

.music-button:active {
    transform: scale(0.95);
    box-shadow:
        0 0 60px rgba(120, 80, 200, 0.3),
        0 5px 15px rgba(0, 0, 0, 0.5);
}

.music-button.playing {
    animation: grow 0.3s ease-out;
}

@keyframes grow {
    0% {
        transform: scale(0.95);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.button-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(120, 80, 200, 0.3);
    animation: pulse 3s ease-in-out infinite;
}

.ring-2 {
    width: 115%;
    height: 115%;
    border-color: rgba(120, 80, 200, 0.15);
    animation-delay: 0.5s;
}

.button-content {
    width: 60%;
    height: 60%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    opacity: 0;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.08);
        opacity: 0.5;
    }
}

@keyframes ripple {
    0% {
        transform: scale(0.8);
        opacity: 0.6;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.music-button.playing .button-ring {
    animation: ripple 0.8s ease-out;
}

.bottom-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.replay-button {
    width: min(14vw, 56px);
    height: min(14vw, 56px);
    border-radius: 50%;
    border: 2px solid rgba(120, 80, 200, 0.3);
    background: rgba(42, 26, 62, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, background 0.15s ease, opacity 0.3s ease;
    -webkit-touch-callout: none;
    opacity: 0;
    pointer-events: none;
    flex-shrink: 0;
}

.replay-button.visible {
    opacity: 1;
    pointer-events: auto;
}

.replay-button:active {
    transform: scale(0.9);
    background: rgba(42, 26, 62, 0.9);
}

.replay-button svg {
    width: 45%;
    height: 45%;
    color: rgba(200, 160, 255, 0.8);
}

.hint-text {
    font-size: 0.85rem;
    font-weight: 300;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: 0.3;
    margin-bottom: 2vh;
}

.replay-button {
    width: min(14vw, 56px);
    height: min(14vw, 56px);
    border-radius: 50%;
    border: 2px solid rgba(120, 80, 200, 0.3);
    background: rgba(42, 26, 62, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, background 0.15s ease, opacity 0.3s ease;
    -webkit-touch-callout: none;
    opacity: 0;
    pointer-events: none;
}

.replay-button.visible {
    opacity: 1;
    pointer-events: auto;
}

.replay-button:active {
    transform: scale(0.9);
    background: rgba(42, 26, 62, 0.9);
}

.replay-button svg {
    width: 45%;
    height: 45%;
    color: rgba(200, 160, 255, 0.8);
}

@media (max-height: 600px) {
    .screen {
        padding: 8vh 0 5vh 0;
    }
    .music-button {
        width: min(35vw, 140px);
        height: min(35vw, 140px);
    }
}

@media (min-height: 850px) {
    .screen {
        padding: 20vh 0 10vh 0;
    }
}
