* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --wheel-bg: #02403d;
    --wheel-border: #ffffff;
    --wheel-text: #000000;
}

html,
body {
    min-height: 100%;
}

body {
    min-height: 100vh;
    overflow: hidden;
    background: var(--wheel-bg);
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

main {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

[hidden] {
    display: none !important;
}

.wheel-page,
.message-view,
.loading {
    width: 100%;
    text-align: center;
}

.wheel-page h1,
.message-view h1 {
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    line-height: 1.05;
    margin-bottom: 6px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.subtitle {
    min-height: 1.4em;
    margin-bottom: 38px;
    font-size: 1rem;
    opacity: 0.82;
}

.wheel-container {
    position: relative;
    width: min(90vw, calc(90vh - 150px));
    height: min(90vw, calc(90vh - 150px));
    max-width: 640px;
    max-height: 640px;
    min-width: 270px;
    min-height: 270px;
    margin: 4px auto;
}

.wheel-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 20px rgba(100, 100, 255, 0.3));
    transition: transform 4s cubic-bezier(0.17, 0.67, 0.12, 0.99);
}

.wheel-pointer {
    position: absolute;
    z-index: 10;
    top: -18px;
    left: 50%;
    width: 0;
    height: 0;
    transform: translateX(-50%);
    border-right: 18px solid transparent;
    border-left: 18px solid transparent;
    border-top: 36px solid #e53935;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

.wheel-center {
    position: absolute;
    z-index: 5;
    top: 50%;
    left: 50%;
    width: 25%;
    height: 25%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translate(-50%, -50%);
    border: 3px solid #ffffff;
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    color: var(--wheel-text);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 800;
    text-align: center;
    transition: transform 0.2s ease;
    user-select: none;
}

.wheel-center:hover {
    transform: translate(-50%, -50%) scale(1.08);
}

.wheel-center img {
    width: 100%;
    height: 100%;
    border-radius: 999px;
    object-fit: contain;
}

.btn {
    display: inline-flex;
    min-height: 52px;
    align-items: center;
    justify-content: center;
    margin-top: 18px;
    padding: 14px 36px;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:hover {
    transform: scale(1.04);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.btn-spin {
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.3);
    color: var(--wheel-text);
}

.btn-claim {
    background: linear-gradient(135deg, #00c853, #00e676);
    box-shadow: 0 4px 20px rgba(0, 200, 83, 0.4);
    color: #ffffff;
}

.btn-replay {
    background: linear-gradient(135deg, #7c4dff, #536dfe);
    box-shadow: 0 4px 20px rgba(124, 77, 255, 0.4);
    color: #ffffff;
}

.result-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.result-overlay.active {
    display: flex;
}

.result-card {
    width: min(100%, 380px);
    padding: 40px 30px;
    border: 3px solid var(--wheel-border);
    border-radius: 20px;
    background: var(--wheel-bg);
    text-align: center;
    animation: pop-in 0.4s ease-out;
}

.result-card h2 {
    margin-bottom: 10px;
    font-size: 1.8rem;
}

.prize-amount {
    margin: 10px 0;
    color: #ffffff;
    font-size: 3rem;
    font-weight: 900;
    line-height: 1;
}

@keyframes pop-in {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.message-view {
    max-width: 420px;
    padding: 40px 20px;
}

.message-view p {
    margin-top: 10px;
}

.timer {
    margin-top: 12px;
    color: #ffd700;
    font-size: 2rem;
    font-weight: 900;
}

.cadon-info a {
    color: #ffd700;
    font-size: 1.35rem;
    font-weight: 800;
    text-decoration: underline;
}

.loading {
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    animation: spin 0.8s linear infinite;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffd700;
    border-radius: 999px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.confetti-canvas {
    position: fixed;
    inset: 0;
    z-index: 200;
    pointer-events: none;
}

@media (max-width: 520px) {
    main {
        padding: 14px;
    }

    .subtitle {
        margin-bottom: 26px;
    }

    .wheel-container {
        width: min(92vw, calc(86vh - 150px));
        height: min(92vw, calc(86vh - 150px));
        min-width: 250px;
        min-height: 250px;
    }

    .btn {
        width: min(100%, 320px);
        padding-inline: 24px;
        font-size: 1rem;
    }

    .result-card {
        padding: 34px 24px;
    }
}
