html,
body {
    height: 100%
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    background: #070b16;
    color: #e2e8f0;
    display: flex;
    overflow-y: auto
}

.bg-anim {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background: radial-gradient(1200px 600px at 10% 10%, #0ea5e9 0%, transparent 60%), radial-gradient(1000px 500px at 90% 10%, #a78bfa 0%, transparent 55%), radial-gradient(1200px 600px at 20% 90%, #22d3ee 0%, transparent 65%), radial-gradient(900px 500px at 80% 80%, #f43f5e 0%, transparent 60%);
    filter: blur(40px) saturate(120%);
    opacity: .25;
    animation: bgMove 28s linear infinite
}

@keyframes bgMove {
    0% {
        transform: translate3d(0, 0, 0)
    }

    50% {
        transform: translate3d(12px, -8px, 0)
    }

    100% {
        transform: translate3d(0, 0, 0)
    }
}

.container {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 16px;
    width: 100%;
    max-width: 1200px;
    margin: auto;
    padding: 16px
}

.panel {
    background: rgba(17, 24, 39, .85);
    border: 1px solid #1f2937;
    border-radius: 16px;
    backdrop-filter: blur(10px)
}

.panel h2 {
    margin: 0;
    padding: 12px 16px;
    border-bottom: 1px solid #1f2937;
    font-weight: 600;
    color: #f8fafc
}

.panel .body {
    padding: 12px 16px
}

textarea {
    width: 100%;
    height: 220px;
    border-radius: 12px;
    border: 1px solid #334155;
    background: #0b1220;
    color: #e2e8f0;
    padding: 12px;
    resize: vertical;
    box-shadow: inset 0 0 0 1px #0ea5e9
}

button {
    appearance: none;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #2563eb, #22d3ee);
    color: #0b1220;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(2, 132, 199, .25), inset 0 0 0 1px rgba(255, 255, 255, .15)
}

button:disabled {
    opacity: .5;
    cursor: not-allowed
}

.btn-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px
}

.input-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px
}

.toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px
}

.wheel-wrap {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 16px
}

.canvas-box {
    position: relative;
    background: #0b1220;
    border-radius: 16px;
    border: 1px solid #1f2937;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    box-shadow: 0 0 0 1px #1f2937, 0 20px 60px rgba(2, 132, 199, .15)
}

.canvas-box {
    cursor: pointer
}

canvas {
    max-width: 100%;
    height: auto
}

.canvas-glow {
    position: absolute;
    inset: 12px;
    border-radius: 12px;
    box-shadow: 0 0 28px #0ea5e9 inset, 0 0 28px #9333ea inset;
    pointer-events: none;
    opacity: .35
}

.pointer {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 18px solid #f43f5e;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .4));
    animation: pulse 1.5s ease-in-out infinite
}

@keyframes pulse {

    0%,
    100% {
        transform: translateX(-50%) translateY(0)
    }

    50% {
        transform: translateX(-50%) translateY(2px)
    }
}

.confetti {
    position: absolute;
    inset: 0;
    pointer-events: none
}

.side {
    background: #0b1220;
    border-radius: 12px;
    border: 1px solid #1f2937;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px
}

.result {
    font-size: 20px;
    font-weight: 800;
    color: #22d3ee;
    min-height: 24px;
    text-shadow: 0 0 10px rgba(34, 211, 238, .35)
}

.history {
    max-height: 240px;
    overflow: auto;
    border: 1px solid #1f2937;
    border-radius: 8px
}

.history-item {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid #1f2937
}

.history-item:last-child {
    border-bottom: 0
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px
}

.table th,
.table td {
    border: 1px solid #1f2937;
    padding: 6px 8px;
    text-align: left
}

.muted {
    color: #94a3b8
}

.small {
    font-size: 12px
}

.footer {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 6px
}

@media (max-width:900px) {
    .container {
        grid-template-columns: 1fr
    }

    .wheel-wrap {
        grid-template-columns: 1fr
    }
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, .65);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000
}

.modal {
    width: min(600px, 90vw);
    background: radial-gradient(circle at center, #1e293b 0%, #000 100%);
    border: 4px solid #38bdf8;
    border-radius: 30px;
    box-shadow: 0 0 100px rgba(56, 189, 248, 0.6), inset 0 0 40px rgba(56, 189, 248, 0.4);
    overflow: hidden;
    position: relative;
    animation: modalPulse 2s infinite;
}

@keyframes modalPulse {
    0% {
        box-shadow: 0 0 50px rgba(56, 189, 248, 0.6), inset 0 0 20px rgba(56, 189, 248, 0.3);
        border-color: #38bdf8;
    }

    50% {
        box-shadow: 0 0 150px rgba(232, 121, 249, 0.8), inset 0 0 60px rgba(232, 121, 249, 0.5);
        border-color: #e879f9;
    }

    100% {
        box-shadow: 0 0 50px rgba(56, 189, 248, 0.6), inset 0 0 20px rgba(56, 189, 248, 0.3);
        border-color: #38bdf8;
    }
}

.modal::before {
    content: '';
    position: absolute;
    top: -100%;
    left: -100%;
    width: 300%;
    height: 300%;
    background: conic-gradient(from 0deg, transparent 0%, rgba(255, 255, 255, 0.1) 15%, transparent 30%);
    animation: rotate 3s linear infinite;
    pointer-events: none;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

.winner-text {
    font-size: 64px;
    font-weight: 900;
    text-align: center;
    text-transform: uppercase;
    line-height: 1.1;
    color: #ffffff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.8), 0 0 40px rgba(255, 255, 255, 0.4);
    animation: scaleUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    margin: 20px 0;
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}

@keyframes popIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes rainbowMove {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 400% 0;
    }
}

@keyframes scaleUp {
    0% {
        transform: scale(0.5) rotate(-10deg);
        opacity: 0;
    }

    70% {
        transform: scale(1.1) rotate(5deg);
        opacity: 1;
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 12px 20px 22px
}

.btn-ghost {
    background: #0b1220;
    color: #e2e8f0;
    border: 1px solid #334155
}

.close-x {
    appearance: none;
    border: 0;
    background: transparent;
    color: #94a3b8;
    font-size: 22px;
    cursor: pointer
}