/* ═══════════════════════════════════════════════════════════
   Lucky Wheel — Styles
   ═══════════════════════════════════════════════════════════ */

/* ── Reset ── */
*,*::before,*::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Nunito', sans-serif;
    color: #fff;
    touch-action: manipulation;
    user-select: none;
}

body {
    background: radial-gradient(ellipse at 30% 50%, #2d1b69 0%, #1b0a3c 50%, #0f0520 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* ── Starfield ── */
.stars {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none; z-index: 0;
}
.star {
    position: absolute;
    width: 2px; height: 2px;
    background: #fff;
    border-radius: 50%;
    animation: twinkle 3s infinite ease-in-out alternate;
}
@keyframes twinkle {
    0%   { opacity: .15; transform: scale(1); }
    100% { opacity: .8;  transform: scale(1.4); }
}

/* ── Game Container ── */
.game-container {
    position: relative; z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
    gap: 0;
}

/* ── Wheel Area ── */
.wheel-area {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
.wheel-wrap  { position: relative; }
.outer-rim   { position: absolute; border-radius: 50%; z-index: 1; }
.inner-rim   { position: absolute; border-radius: 50%; z-index: 2; }

/* LED Ring */
.led-ring {
    position: absolute;
    z-index: 5;
    pointer-events: none;
}
.led {
    position: absolute;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #fde68a;
    box-shadow: 0 0 8px 3px rgba(253, 230, 138, .9);
    transition: background .12s, box-shadow .12s;
}
.led.off {
    background: #6b5c2a;
    box-shadow: 0 0 2px 1px rgba(107, 92, 42, .3);
}

/* Wheel Canvas */
#wheelCanvas {
    position: absolute;
    z-index: 3;
    border-radius: 50%;
}

/* Center Hub */
.center-hub {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: center;
}
.center-hub-inner {
    border-radius: 50%;
    background: radial-gradient(circle at 38% 35%, #e2e8f0, #94a3b8);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, .3);
}

/* Pointer (right side, pointing inward) */
.pointer-wrap {
    position: absolute;
    top: 50%;
    z-index: 15;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .6));
}
.pointer-wrap svg { display: block; }

/* ── Right Panel ── */
.right-panel {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 60px;
    margin-left: 200px;
}

/* Info Panel */
.info-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    min-width: 520px;
    max-width: 520px;
}
.title-text {
    font-family: 'Bungee Shade', cursive;
    font-size: 4.5rem;
    background: linear-gradient(180deg, #fde68a, #fbbf24, #d97706);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(2px 3px 0px #7c2d12);
    text-align: center;
    line-height: 1.05;
}
.message-box {
    background: linear-gradient(145deg, rgba(124, 58, 237, .55), rgba(109, 40, 217, .75));
    border: 2px solid rgba(167, 139, 250, .4);
    border-radius: 22px;
    padding: 32px 38px;
    text-align: center;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .08);
    width: 100%;
}
.message-box .subtitle {
    font-size: 1.5rem;
    color: #ddd0f7;
    margin-bottom: 10px;
    font-weight: 700;
}
.message-box .prize-display {
    font-family: 'Bungee', cursive;
    font-size: 1.6rem;
    color: #fbbf24;
    text-shadow: 0 0 14px rgba(251, 191, 36, .35);
}
.message-box .result-text {
    font-family: 'Fredoka One', cursive;
    font-size: 2.4rem;
    color: #fff;
    text-shadow: 0 0 12px rgba(255, 255, 255, .25);
    display: none;
}
.pull-hint {
    font-family: 'Bungee', cursive;
    font-size: 1.1rem;
    color: rgba(167, 139, 250, .6);
    letter-spacing: 2.5px;
    text-align: center;
    margin-top: 4px;
    animation: pulseHint 2s ease-in-out infinite;
}
@keyframes pulseHint {
    0%, 100% { opacity: .5; }
    50%      { opacity: 1; }
}

/* ── Lever (horizontal arm, pivot on machine edge, rotateX for depth) ── */
.lever-section {
    position: relative;
    width: 180px;
    height: 360px;
}
/* Rotating arm — pivot at LEFT edge, rotates in Z-axis (into/out of screen) */
.lever-arm {
    position: absolute;
    left: 10px;
    top: calc(50% - 6px);
    width: 140px;
    height: 12px;
    transform-origin: 0 50%;
    transform: rotate(-60deg);
}
/* Gold rod/shaft — horizontal, metallic cylinder */
.lever-shaft {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #9a7a1e, #c9a832, #f0d860, #ffe07a, #f0d860, #c9a832, #9a7a1e);
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,.35),
                0 -1px 2px rgba(0,0,0,.1),
                inset 0 2px 2px rgba(255,255,255,.2),
                inset 0 -2px 3px rgba(0,0,0,.25);
}
/* Highlight streak along the rod */
.lever-shaft::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 10px;
    right: 10px;
    height: 3px;
    background: linear-gradient(90deg, rgba(255,255,255,.05), rgba(255,255,255,.3), rgba(255,255,255,.05));
    border-radius: 1.5px;
}
/* Handle grab area — at the RIGHT end (ball end) */
.lever-handle {
    position: absolute;
    right: -28px;
    top: -28px;
    width: 68px; height: 68px;
    cursor: grab;
    touch-action: none;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lever-handle:active { cursor: grabbing; }
/* Dark glossy ball */
.lever-knob {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: radial-gradient(circle at 36% 30%, #ff6b6b, #d62828, #8b0000, #4a0000);
    border: 2px solid rgba(180, 40, 40, 0.45);
    box-shadow:
        0 5px 16px rgba(0, 0, 0, 0.6),
        0 2px 5px rgba(0, 0, 0, 0.4),
        inset 0 -4px 8px rgba(80, 0, 0, 0.55),
        inset 0 4px 8px rgba(255, 180, 180, 0.18);
    transition: filter 0.15s, transform 0.15s;
    position: relative;
}
.lever-knob.hot {
    filter: brightness(1.4);
    transform: scale(1.08);
}
/* Specular highlight */
.lever-knob::before {
    content: '';
    position: absolute;
    top: 7px; left: 10px;
    width: 20px; height: 12px;
    background: rgba(255, 255, 255, .3);
    border-radius: 50%;
    transform: rotate(-25deg);
}
/* Secondary reflection */
.lever-knob::after {
    content: '';
    position: absolute;
    bottom: 10px; right: 12px;
    width: 7px; height: 4px;
    background: rgba(255, 255, 255, .08);
    border-radius: 50%;
}
/* Pivot / axis — on the LEFT edge, vertically centered */
.lever-pivot {
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #e8c84a, #c9a832, #9a7a1e, #7a5e14);
    box-shadow: 0 3px 10px rgba(0,0,0,.5),
                inset 0 2px 4px rgba(255,255,255,.25),
                inset 0 -2px 4px rgba(0,0,0,.3);
    z-index: 10;
}
/* Center pin on pivot */
.lever-pivot::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 14px; height: 14px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #fde68a, #c9a832, #8a6a18);
    box-shadow: inset 0 1px 2px rgba(255,255,255,.3),
                inset 0 -1px 2px rgba(0,0,0,.3);
}
.lever-label {
    position: absolute;
    bottom: 8px;
    left: 0;
    width: 100%;
    font-family: 'Bungee', cursive;
    font-size: .85rem;
    color: rgba(155, 114, 207, .6);
    letter-spacing: 2px;
    text-align: center;
}

/* ── Settings ── */
.settings-toggle {
    display: none;
    position: fixed;
    bottom: 16px; right: 16px;
    z-index: 100;
    background: rgba(124, 58, 237, .35);
    border: 1px solid rgba(167, 139, 250, .25);
    color: #c4b5fd;
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: .75rem;
    letter-spacing: 1px;
    transition: all .2s;
}
.settings-toggle:hover {
    background: rgba(124, 58, 237, .6);
    color: #fff;
}
.settings-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, .7);
    z-index: 90;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}
.settings-overlay.open { display: flex; }
.settings-card {
    background: rgba(15, 5, 32, .96);
    border: 1px solid rgba(124, 58, 237, .3);
    border-radius: 18px;
    padding: 24px;
    max-width: 900px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
    backdrop-filter: blur(14px);
}
.settings-card h3 {
    font-family: 'Bungee', cursive;
    font-size: .85rem;
    color: #a78bfa;
    margin-bottom: 14px;
    text-align: center;
}
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 10px;
}
.option-card {
    background: rgba(45, 27, 105, .45);
    border: 1px solid rgba(167, 139, 250, .15);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.option-card .card-header { display: flex; align-items: center; gap: 6px; }
.option-card .color-dot {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .25);
    flex-shrink: 0;
}
.option-card .card-title { font-weight: 800; font-size: .8rem; }
.option-card label {
    font-size: .62rem;
    color: #a78bfa;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.option-card input {
    width: 100%;
    background: rgba(0, 0, 0, .3);
    border: 1px solid rgba(167, 139, 250, .25);
    color: #fff;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: .75rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    outline: none;
}
.option-card input:focus { border-color: #fbbf24; }
.option-card .row { display: flex; gap: 6px; }
.option-card .row > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }

/* ── Sound Toggle ── */
.sound-toggle {
    position: fixed;
    top: 16px; right: 16px;
    z-index: 100;
    background: rgba(124, 58, 237, .45);
    border: 1px solid rgba(167, 139, 250, .25);
    color: #fff;
    width: 42px; height: 42px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
}
.sound-toggle:hover { background: rgba(124, 58, 237, .75); }

/* ── Confetti Canvas ── */
#confettiCanvas {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 50;
}

/* ── Win Overlay / Modal ── */
.win-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, .65);
    z-index: 60;
    align-items: center;
    justify-content: center;
}
.win-overlay.show { display: flex; }
.win-card {
    background: linear-gradient(150deg, #2d1b69, #1b0a3c);
    border: 4px solid #fbbf24;
    border-radius: 32px;
    padding: 54px 66px;
    text-align: center;
    box-shadow: 0 0 120px rgba(251, 191, 36, .3), 0 30px 80px rgba(0, 0, 0, .5);
    animation: popIn .45s cubic-bezier(.175, .885, .32, 1.275);
    max-width: 660px;
    width: 92%;
    position: relative;
    overflow: hidden;
}
.win-card::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: conic-gradient(from 0deg, transparent, rgba(251, 191, 36, .06), transparent, rgba(251, 191, 36, .06), transparent);
    animation: winRotate 4s linear infinite;
}
@keyframes winRotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.win-card-content { position: relative; z-index: 1; }
.win-card .win-emoji {
    font-size: 6.5rem;
    margin-bottom: 12px;
    animation: bounce 1s ease infinite;
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}
.win-card .win-label {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 1.3rem;
    color: #c4b5fd;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.win-card .win-title {
    font-family: 'Bungee Shade', cursive;
    font-size: 3.3rem;
    color: #fbbf24;
    margin-bottom: 14px;
}
.win-card .win-prize-name {
    font-family: 'Fredoka One', cursive;
    font-size: 2.7rem;
    color: #fff;
    margin-bottom: 10px;
}
.win-card .win-description {
    font-size: 1.35rem;
    color: #c4b5fd;
    margin-bottom: 30px;
    line-height: 1.5;
}

/* ── Claim / Action Button ── */
.claim-btn {
    background: linear-gradient(180deg, #4ade80, #22c55e, #16a34a);
    border: none;
    border-radius: 28px;
    padding: 14px 48px;
    font-family: 'Bungee', cursive;
    font-size: 1.1rem;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 5px 0 #15803d, 0 8px 20px rgba(22, 163, 74, .4);
    transition: all .1s;
    text-shadow: 0 1px 0 rgba(0, 0, 0, .15);
    position: relative;
    overflow: hidden;
}
.claim-btn:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 #15803d;
}
.claim-btn .btn-shine {
    position: absolute;
    top: 0; left: -60%;
    width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .25), transparent);
    transform: skewX(-20deg);
    border-radius: 28px;
    animation: btnShine 2.5s infinite;
}
@keyframes btnShine {
    0%   { left: -60%; }
    35%  { left: 120%; }
    100% { left: 120%; }
}
@keyframes popIn {
    0%   { transform: scale(.4) translateY(30px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* ── History Bar ── */
.history-bar {
    position: fixed;
    bottom: 16px; left: 16px;
    z-index: 10;
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    max-width: 90%;
}
.history-chip {
    background: rgba(45, 27, 105, .55);
    border: 1px solid rgba(167, 139, 250, .15);
    border-radius: 16px;
    padding: 3px 12px;
    font-size: .7rem;
    font-weight: 700;
    color: #c4b5fd;
    display: flex;
    align-items: center;
    gap: 4px;
}
.history-chip .h-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
