html {
    font-size: 100%;
}

body {
    margin: 0;
    font-family: system-ui, sans-serif;
    background: radial-gradient(circle at top, #1a1a2e, #000);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: clamp(0.75rem, 3vw, 2rem);
    box-sizing: border-box;
}

h1 {
    font-size: clamp(1.6rem, 5vw, 2.4rem);
    margin: 0;
    line-height: 1.1;
}

.container {
    width: 100%;
    max-width: 42rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: auto;
    padding-top: 2rem;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@media (min-width: 640px) {
    .controls {
        flex-direction: row;
        align-items: center;
    }

    .controls button {
        width: auto;
    }
}

input {
    font-size: 0.95rem;
    padding: 0.4rem 0.6rem;
    min-height: 2.5rem;
    border-radius: 0.5rem;
    border: none;
    flex: 1;
}

button {
    font-size: 0.95rem;
    padding: 0.4rem 0.8rem;
    min-height: 2.5rem;
    font-weight: 600;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #ff9800, #ff5722);
    color: white;
    width: 100%;
    touch-action: manipulation;
}

button:active {
    transform: scale(0.97);
}

#menuBtn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.9rem;
    padding: 0.35rem 0.6rem;
    min-height: 2.2rem;
    width: auto;
    z-index: 200;
}

.menu {
    position: absolute;
    top: 3.25rem;
    right: 1rem;
    background: #222;
    border-radius: 0.5rem;
    overflow: hidden;
    width: min(90vw, 16rem);
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.5);
    border: 0.05rem solid white;
}

.menu.open {
    max-height: 50vh;
    opacity: 1;
}

.menu-item {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
    min-height: 2.5rem;
    font-weight: 600;
    border-bottom: 0.05rem solid white;
    padding: 0.4rem 0.6rem;
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:hover {
    background: #7A7355;
}

.menu-item:active {
    background: rgba(255, 255, 255, 0.1);
}

.menu-item .delete {
    color: red;
    font-size: 1rem;
    cursor: pointer;
}

#wheel-container {
    position: relative;
    width: 100%;
    max-width: min(90vw, 36rem);
    margin: 0 auto;
}

canvas {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    box-shadow: 0 0 2rem rgba(255, 204, 0, 0.4);
}

.pointer {
    position: absolute;
    top: 50%;
    right: 2%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 0.8rem solid transparent;
    border-bottom: 0.8rem solid transparent;
    border-right: 1.6rem solid white;
}

#spin {
    position: relative;
    overflow: hidden;
    font-size: 1rem;
    min-height: 2.8rem;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}

#spin::before {
    content: "";
    position: absolute;
    top: 0;
    left: -75%;
    width: 50%;
    height: 100%;
    background: linear-gradient(120deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.4) 50%,
            rgba(255, 255, 255, 0) 100%);
    transform: skewX(-25deg);
    animation: spinShimmer 2s infinite;
    pointer-events: none;
}

@keyframes spinShimmer {
    0% {
        left: -75%;
    }

    100% {
        left: 125%;
    }
}

#spin.spinning {
    animation: pulseGlow 1s ease-in-out infinite alternate;
    box-shadow: 0 0 1rem rgba(255, 152, 0, 0.6),
        0 0 2rem rgba(255, 87, 34, 0.5);
    transform: scale(1.03);
}

@keyframes pulseGlow {
    from {
        box-shadow: 0 0 0.75rem rgba(255, 152, 0, 0.6),
            0 0 1.5rem rgba(255, 87, 34, 0.4);
    }

    to {
        box-shadow: 0 0 1.5rem rgba(255, 152, 0, 0.9),
            0 0 3rem rgba(255, 87, 34, 0.7);
    }
}

#spin:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

#result {
    font-size: 1.1rem;
    color: #ffcc00;
    min-height: 1.5em;
}

footer {
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    padding-top: 1rem;
}