:root {
    --bg: #10111f;
    --bg-deep: #090b13;
    --surface: rgba(15, 18, 35, 0.74);
    --surface-strong: rgba(18, 22, 43, 0.92);
    --surface-border: rgba(255, 255, 255, 0.1);
    --text: #fbfbfd;
    --muted: rgba(251, 251, 253, 0.76);
    --subtle: rgba(251, 251, 253, 0.56);
    --lime: #a1ff6b;
    --mint: #6fffd1;
    --sun: #ffd54f;
    --orange: #ff9a3c;
    --coral: #ff6f61;
    --rose: #ff4d8d;
    --sky: #59b7ff;
    --shadow: 0 28px 70px rgba(0, 0, 0, 0.35);
    --radius-xl: 32px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --wheel-size: min(84vw, 34rem);
    --wheel-rotation: 0deg;
    --wheel-gradient: conic-gradient(from -22.5deg, #ff9a3c 0deg 45deg, #ffd54f 45deg 90deg, #a1ff6b 90deg 135deg, #6fffd1 135deg 180deg, #59b7ff 180deg 225deg, #748bff 225deg 270deg, #ff6f61 270deg 315deg, #ff4d8d 315deg 360deg);
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Avenir Next", "Trebuchet MS", "Gill Sans", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(255, 154, 60, 0.22), transparent 28%),
        radial-gradient(circle at 85% 15%, rgba(89, 183, 255, 0.22), transparent 28%),
        radial-gradient(circle at 50% 85%, rgba(161, 255, 107, 0.18), transparent 24%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
    color: var(--text);
    overflow-x: hidden;
}

button {
    font: inherit;
}

.confetti-layer,
.ambient-grid,
.ambient-glow {
    pointer-events: none;
    position: fixed;
    inset: 0;
}

.confetti-layer {
    z-index: 5;
}

.ambient-grid {
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 86%);
    opacity: 0.32;
}

.ambient-glow {
    filter: blur(100px);
    opacity: 0.7;
}

.ambient-glow-left {
    background: radial-gradient(circle, rgba(255, 111, 97, 0.28) 0%, transparent 58%);
    transform: translate(-12%, -24%);
}

.ambient-glow-right {
    background: radial-gradient(circle, rgba(89, 183, 255, 0.28) 0%, transparent 58%);
    transform: translate(18%, -18%);
}

.app-shell {
    position: relative;
    z-index: 1;
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(280px, 430px) minmax(340px, 1fr);
    gap: 32px;
    align-items: center;
    padding: 40px 0;
}

.intro-panel,
.wheel-panel {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    box-shadow: var(--shadow);
}

.intro-panel {
    border-radius: var(--radius-xl);
    padding: 36px;
    overflow: hidden;
}

.intro-panel::after {
    content: "";
    position: absolute;
    inset: auto -10% -20% 35%;
    height: 220px;
    background: radial-gradient(circle, rgba(255, 213, 79, 0.22), transparent 68%);
}

.wheel-panel {
    border-radius: 40px;
    padding: 40px 28px 28px;
}

.eyebrow {
    margin: 0 0 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-size: 0.72rem;
    color: var(--lime);
    font-weight: 700;
}

h1 {
    margin: 0;
    font-size: clamp(3rem, 4vw, 4.8rem);
    line-height: 0.95;
    letter-spacing: -0.05em;
}

.lead {
    margin: 22px 0 0;
    max-width: 38ch;
    font-size: 1.08rem;
    line-height: 1.7;
    color: var(--muted);
}

.action-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 18px;
    align-items: center;
    margin-top: 28px;
    padding: 18px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.sound-toggle {
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    background: linear-gradient(135deg, rgba(161, 255, 107, 0.9), rgba(111, 255, 209, 0.9));
    color: #06110d;
    font-weight: 800;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(111, 255, 209, 0.25);
    transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.sound-toggle:hover,
.sound-toggle:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(111, 255, 209, 0.32);
}

.sound-toggle.is-muted {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text);
    box-shadow: none;
}

.microcopy {
    margin: 0;
    color: var(--subtle);
    font-size: 0.95rem;
}

.legend-panel {
    margin-top: 28px;
}

.legend-title {
    margin: 0 0 14px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--subtle);
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.feature-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--muted);
    font-weight: 600;
}

.feature-chip::before {
    content: "";
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--chip-color, var(--sun));
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.16);
    flex: 0 0 auto;
}

.pointer-stack {
    position: relative;
    display: grid;
    place-items: center;
    margin-bottom: -24px;
    z-index: 2;
}

.pointer-ring {
    width: 78px;
    height: 78px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #fff, #ffd54f 48%, #ff9a3c 74%, #b03507 100%);
    box-shadow: 0 18px 28px rgba(0, 0, 0, 0.32);
}

.pointer {
    width: 0;
    height: 0;
    margin-top: -4px;
    border-left: 18px solid transparent;
    border-right: 18px solid transparent;
    border-top: 28px solid #fff9df;
    filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.3));
}

.wheel-stage {
    display: grid;
    place-items: center;
    margin-top: 6px;
}

.wheel {
    position: relative;
    width: var(--wheel-size);
    height: var(--wheel-size);
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.14), transparent 58%),
        var(--wheel-gradient);
    border: 12px solid rgba(255, 255, 255, 0.12);
    box-shadow:
        0 0 0 10px rgba(255, 255, 255, 0.04),
        0 24px 48px rgba(0, 0, 0, 0.34),
        inset 0 12px 24px rgba(255, 255, 255, 0.14),
        inset 0 -16px 26px rgba(0, 0, 0, 0.18);
    transform: rotate(0deg);
    transition: box-shadow 180ms ease;
    will-change: transform;
    touch-action: none;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.wheel::before,
.wheel::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    inset: 10px;
    pointer-events: none;
}

.wheel::before {
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.wheel::after {
    inset: 22px;
    background:
        radial-gradient(circle, transparent 68%, rgba(255, 255, 255, 0.16) 69%, transparent 71%),
        repeating-conic-gradient(from -22.5deg, rgba(255, 255, 255, 0.18) 0deg 1.2deg, transparent 1.2deg 45deg);
    opacity: 0.42;
}

.wheel.is-active {
    box-shadow:
        0 0 0 10px rgba(255, 255, 255, 0.04),
        0 32px 64px rgba(0, 0, 0, 0.42),
        0 0 80px rgba(255, 213, 79, 0.18),
        inset 0 12px 24px rgba(255, 255, 255, 0.14),
        inset 0 -16px 26px rgba(0, 0, 0, 0.18);
}

.wheel.is-dragging {
    cursor: grabbing;
}

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

.segment-label {
    position: absolute;
    top: 50%;
    left: 50%;
    width: clamp(96px, 20vw, 152px);
    text-align: center;
    transform:
        translate(-50%, -50%)
        rotate(var(--angle))
        translateY(calc(var(--wheel-size) * -0.34))
        rotate(calc(var(--angle) * -1));
}

.segment-label span {
    display: block;
    padding: 8px 10px;
    border-radius: 16px;
    background: rgba(12, 15, 26, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.95);
    font-size: clamp(0.72rem, 1.5vw, 0.96rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: 0.01em;
}

.wheel--dense .segment-label {
    width: clamp(78px, 16vw, 118px);
}

.wheel--dense .segment-label span {
    padding: 6px 8px;
    font-size: clamp(0.66rem, 1.15vw, 0.82rem);
}

.wheel--ultra-dense .segment-label {
    width: clamp(66px, 13vw, 102px);
}

.wheel--ultra-dense .segment-label span {
    padding: 5px 7px;
    font-size: clamp(0.58rem, 1vw, 0.74rem);
}

.wheel-center {
    position: absolute;
    inset: 50%;
    transform: translate(-50%, -50%);
    width: 34%;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fff7c0, #ffcc5f 34%, #ff8d2a 74%, #6b2306 100%);
    box-shadow:
        inset 0 6px 12px rgba(255, 255, 255, 0.34),
        inset 0 -10px 20px rgba(95, 32, 2, 0.36),
        0 14px 26px rgba(0, 0, 0, 0.28);
    z-index: 2;
}

.wheel-center-rings {
    position: absolute;
    inset: 9%;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow:
        0 0 0 8px rgba(255, 255, 255, 0.08),
        inset 0 0 0 6px rgba(255, 255, 255, 0.06);
    pointer-events: none;
}

.spin-button {
    position: relative;
    z-index: 3;
    display: grid;
    gap: 3px;
    place-items: center;
    width: 78%;
    aspect-ratio: 1;
    border: 0;
    border-radius: 50%;
    background: rgba(11, 12, 21, 0.9);
    color: #fff;
    cursor: pointer;
    box-shadow:
        0 10px 20px rgba(0, 0, 0, 0.22),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
    touch-action: manipulation;
}

.spin-button:hover,
.spin-button:focus-visible {
    transform: scale(1.03);
    box-shadow:
        0 12px 26px rgba(0, 0, 0, 0.28),
        0 0 24px rgba(255, 213, 79, 0.22),
        inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.spin-button:disabled {
    cursor: wait;
    opacity: 0.85;
}

.spin-button-text {
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    font-weight: 900;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.spin-button-subtext {
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.62);
}

.result-card {
    margin-top: 22px;
    border-radius: var(--radius-lg);
    padding: 22px;
    background: var(--surface-strong);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.result-kicker {
    margin: 0;
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--lime);
    font-weight: 800;
}

.result-card h2 {
    margin: 10px 0 0;
    font-size: clamp(1.6rem, 3vw, 2.3rem);
    line-height: 1.02;
    letter-spacing: -0.04em;
}

.result-description {
    margin: 14px 0 0;
    color: var(--muted);
    line-height: 1.65;
    max-width: 58ch;
}

.result-card.is-winning {
    animation: winnerPulse 700ms ease;
}

.reveal {
    animation: riseIn 700ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.wheel-panel.reveal {
    animation-delay: 120ms;
}

@keyframes riseIn {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes winnerPulse {
    0% {
        box-shadow: 0 0 0 rgba(255, 213, 79, 0);
    }

    40% {
        box-shadow: 0 0 0 10px rgba(255, 213, 79, 0.18);
    }

    100% {
        box-shadow: 0 0 0 rgba(255, 213, 79, 0);
    }
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
        padding: 24px 0 36px;
    }

    .intro-panel,
    .wheel-panel {
        padding: 28px 22px;
    }

    .wheel-panel {
        overflow: hidden;
    }
}

@media (max-width: 720px) {
    :root {
        --wheel-size: min(88vw, 29rem);
    }

    h1 {
        font-size: clamp(2.5rem, 12vw, 3.4rem);
    }

    .feature-list {
        grid-template-columns: 1fr;
    }

    .segment-label {
        width: clamp(86px, 29vw, 120px);
    }

    .segment-label span {
        font-size: 0.7rem;
        padding: 6px 8px;
    }

    .spin-button-text {
        font-size: 1rem;
    }

    .spin-button-subtext {
        font-size: 0.62rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
    }

    .reveal,
    .result-card.is-winning {
        animation: none;
    }

    .sound-toggle,
    .spin-button,
    .wheel {
        transition: none;
    }
}
