:root {
    --color-primary: #1a1a1a;
    --color-secondary: #2d2d2d;
    --color-accent: #c41e3a;
    --color-accent-dark: #a01830;
    --color-accent-light: #e63950;
    --color-gold: #f6b73c;
    --color-gold-dark: #d89a2f;
    --color-text: #ececec;
    --color-white: #ffffff;
    --color-cream: #f8f8f8;
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    color: var(--color-text);
    background: radial-gradient(circle at 18% 12%, rgba(196, 30, 58, 0.26), transparent 30%),
                radial-gradient(circle at 80% 18%, rgba(246, 183, 60, 0.16), transparent 28%),
                linear-gradient(165deg, #070707 0%, #111111 45%, #161616 100%);
    background-attachment: fixed;
    overflow-x: hidden;
}

.page-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(10px);
    animation: drift 14s ease-in-out infinite;
}

.orb-1 {
    width: 260px;
    height: 260px;
    background: radial-gradient(circle, rgba(196, 30, 58, 0.25), transparent 70%);
    top: -80px;
    left: -60px;
}

.orb-2 {
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(246, 183, 60, 0.22), transparent 70%);
    right: -100px;
    bottom: -120px;
    animation-delay: 1.8s;
}

.bg-grid {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 32px 32px;
}

.wheel-page {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1.2rem 3.5rem;
}

.hero {
    text-align: center;
    margin-bottom: 1.8rem;
    position: relative;
}

.hero-badge {
    display: inline-block;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-accent);
    font-weight: 700;
    font-size: 0.78rem;
    margin-bottom: 0.7rem;
}

.hero h1 {
    margin: 0;
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 4vw, 3rem);
    line-height: 1.1;
    color: #fafafa;
    text-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
}

.hero-text {
    margin: 0.75rem auto 0;
    max-width: 720px;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.84);
}

.game-card {
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(20, 20, 20, 0.92), rgba(34, 34, 34, 0.86));
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    box-shadow: 0 24px 52px rgba(0, 0, 0, 0.4);
    padding: 1.2rem;
    position: relative;
    overflow: hidden;
}

.game-card::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(105deg, rgba(196, 30, 58, 0.08), transparent 25%, transparent 70%, rgba(246, 183, 60, 0.12));
}

.game-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.4rem;
}

.left-panel,
.right-panel {
    border-radius: 18px;
    background: linear-gradient(170deg, rgba(10, 10, 10, 0.72), rgba(30, 30, 30, 0.68));
    border: 1px solid rgba(255, 255, 255, 0.16);
    padding: 1rem;
    position: relative;
}

.right-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.player-form {
    display: grid;
    gap: 0.55rem;
}

.player-form label {
    font-size: 0.92rem;
    font-weight: 600;
    color: #f0f0f0;
}

.player-form input {
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.25);
    border-radius: 10px;
    padding: 0.7rem 0.85rem;
    font-size: 0.95rem;
    color: #1a1a1a;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.player-form input::placeholder {
    color: #666666;
}

.player-form input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.12);
}

.player-form input.input-error {
    border-color: #cf233f;
    box-shadow: 0 0 0 3px rgba(207, 35, 63, 0.22);
    background: #fff5f7;
}

.quota-box,
.rules-box,
.prize-box,
.result-box {
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(22, 22, 22, 0.95), rgba(35, 35, 35, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 0.85rem;
}

.quota-box {
    margin-top: 0.45rem;
    font-size: 0.92rem;
}

.quota-box p {
    margin: 0;
}

#cooldownInfo {
    margin-top: 0.4rem;
    color: #d8d8d8;
}

.spin-btn {
    margin-top: 0.35rem;
    width: 100%;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
    color: var(--color-white);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.85rem 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    box-shadow: 0 8px 18px rgba(160, 24, 48, 0.26);
}

.spin-btn:hover {
    transform: translateY(-1px);
}

.spin-btn:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.rules-box {
    margin-top: 0.9rem;
}

.rules-bottom {
    margin-top: 0.35rem;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: linear-gradient(145deg, rgba(28, 28, 28, 0.98), rgba(42, 42, 42, 0.92));
}

.rules-box h2,
.prize-box h2 {
    margin: 0 0 0.55rem;
    font-family: var(--font-heading);
    font-size: 1rem;
    color: #f6f6f6;
}

.rules-box ul,
.prize-box ul {
    margin: 0;
    padding-left: 1rem;
}

.rules-box li,
.prize-box li {
    margin: 0.3rem 0;
    font-size: 0.92rem;
    color: #f1f1f1;
}

.prize-box ul {
    padding-left: 0;
    list-style: none;
}

.prize-box li {
    margin: 0.38rem 0;
    padding: 0.44rem 0.55rem;
    border-radius: 8px;
    background: linear-gradient(90deg, #d8f2ff, #f2fbff);
    border: 1px solid #7fc5e9;
    color: #0f2a3a;
    font-weight: 600;
}

.wheel-shell {
    position: relative;
    width: min(100%, 520px);
    aspect-ratio: 1 / 1;
    margin: 0.3rem auto 0.8rem;
    filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.42));
}

.wheel-shell::before {
    content: '';
    position: absolute;
    inset: -16px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #111111, #c41e3a, #f6b73c, #1f7ae0, #1fa35c, #111111);
    animation: wheelShine 8s linear infinite;
    z-index: 0;
}

.wheel-shell::after {
    content: '';
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0));
    z-index: 0;
}

.wheel-particles {
    position: absolute;
    inset: -26px;
    z-index: 4;
    pointer-events: none;
}

.wheel-particles .particle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fff, #ffd56a 62%, #ff9e27 100%);
    opacity: 0.46;
    transform: rotate(var(--angle)) translateY(calc(var(--distance) * -1));
    animation: orbitPulse 3.2s ease-in-out infinite;
    animation-delay: var(--delay);
    filter: drop-shadow(0 0 8px rgba(255, 197, 90, 0.52));
}

#wheelCanvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, #1a1a1a, #0f0f0f);
    border: 10px solid #0f0f0f;
    display: block;
    transform: rotate(0deg);
    position: relative;
    z-index: 1;
}

.wheel-pointer {
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 22px solid transparent;
    border-right: 22px solid transparent;
    border-top: 40px solid var(--color-gold);
    filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.25));
    z-index: 3;
}

.wheel-center {
    position: absolute;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #232323, #0d0d0d);
    color: #fff;
    display: grid;
    place-items: center;
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: 0.08em;
    border: 4px solid var(--color-gold);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.2), 0 4px 16px rgba(0, 0, 0, 0.35);
    z-index: 2;
}

.wheel-center img {
    width: 70%;
    height: 70%;
    object-fit: contain;
    border-radius: 50%;
    padding: 3px;
    background: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.35);
}

.wheel-shell.celebrate {
    filter: drop-shadow(0 0 18px rgba(246, 183, 60, 0.9)) drop-shadow(0 0 34px rgba(196, 30, 58, 0.65));
}

.wheel-shell.celebrate::before {
    animation-duration: 1.3s;
}

.wheel-shell.celebrate .wheel-particles .particle {
    opacity: 1;
    transform: rotate(var(--angle)) translateY(calc((var(--distance) + 12px) * -1)) scale(1.15);
}

.result-box {
    text-align: center;
    font-size: 0.95rem;
    margin-bottom: 0.7rem;
    min-height: 52px;
    display: grid;
    place-items: center;
}

.right-panel .spin-btn {
    margin: 0;
    width: 100%;
    max-width: none;
    align-self: stretch;
}

.result-box.win {
    border-color: rgba(216, 154, 47, 0.65);
    background: linear-gradient(145deg, rgba(246, 183, 60, 0.35), rgba(30, 30, 30, 0.93));
}

.result-box.error {
    border-color: rgba(207, 35, 63, 0.82);
    background: linear-gradient(145deg, rgba(207, 35, 63, 0.34), rgba(38, 16, 20, 0.96));
    color: #ffeef1;
    animation: errorPulse 0.55s ease;
}

.result-box strong {
    color: #ffffff;
}

.clock-display {
    margin: 0.85rem 0 0;
    border-radius: 10px;
    padding: 0.6rem;
    text-align: center;
    font-size: 0.9rem;
    background: #1f1f1f;
    color: #f5f5f5;
    letter-spacing: 0.02em;
}

@keyframes wheelShine {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes orbitPulse {
    0%,
    100% {
        opacity: 0.42;
        transform: rotate(var(--angle)) translateY(calc(var(--distance) * -1)) scale(0.9);
    }
    50% {
        opacity: 0.85;
        transform: rotate(var(--angle)) translateY(calc(var(--distance) * -1)) scale(1.12);
    }
}

@keyframes errorPulse {
    0% {
        transform: scale(0.985);
    }
    60% {
        transform: scale(1.01);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes drift {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(18px, -12px) scale(1.05);
    }
}

@media (max-width: 980px) {
    .game-layout {
        grid-template-columns: 1fr;
    }

    .left-panel {
        order: 1;
    }

    .right-panel {
        order: 2;
    }
}

@media (max-width: 520px) {
    .wheel-page {
        padding: 1rem 0.75rem 2.2rem;
    }

    .game-card,
    .left-panel,
    .right-panel {
        padding: 0.8rem;
    }

    .wheel-pointer {
        border-left-width: 14px;
        border-right-width: 14px;
        border-top-width: 28px;
        top: -8px;
    }

    .wheel-shell::before {
        inset: -10px;
    }

    .wheel-shell::after {
        inset: -4px;
    }

    .wheel-particles {
        display: none;
    }

    .right-panel .spin-btn {
        width: 100%;
        max-width: none;
    }

    .rules-bottom {
        display: block !important;
    }

    .wheel-center {
        width: 74px;
        height: 74px;
    }

    .wheel-center img {
        width: 74%;
        height: 74%;
        padding: 2px;
    }
}
