/* ==========================================================================
   WHEEL OF NAMES - ENHANCED WITH ADVANCED ANIMATIONS
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #A52A2A;
    --secondary-color: #8B1A1A;
    --light-color: #C85250;
    --lighter-color: #E88D8D;
    --lightest-color: #FFE5E5;
    
    --shadow-soft: 0 8px 32px rgba(165, 42, 42, 0.1);
    --shadow-medium: 0 12px 48px rgba(165, 42, 42, 0.15);
    --shadow-strong: 0 20px 60px rgba(165, 42, 42, 0.25);
    
    --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
    position: relative;
}

/* ==========================================================================
   BACKGROUND IMAGE WITH NATURAL SWAYING ANIMATION
   ========================================================================== */
.background-image {
    position: fixed;
    top: -5%;
    left: -5%;
    width: 110%;
    height: 110%;
    background: url("background1.png") no-repeat center center;
    background-size: cover;
    z-index: -3;
    filter: brightness(0.9);
    animation: backgroundSway 15s ease-in-out infinite;
    transform-origin: center center;
}

@keyframes backgroundSway {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(1%, -0.5%) scale(1.02);
    }
    50% {
        transform: translate(-1%, 0.5%) scale(1.01);
    }
    75% {
        transform: translate(0.5%, -0.3%) scale(1.015);
    }
}

.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.6),
        rgba(165, 42, 42, 0.4)
    );
    z-index: -2;
}

/* ==========================================================================
   ANIMATED BACKGROUND SYSTEM (Geometric Shapes & Particles)
   ========================================================================== */
.animated-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.geometric-shape {
    position: absolute;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    opacity: 0.06;
    animation: shapeFloat 20s infinite ease-in-out;
}

.shape-1 {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    top: 20%;
    left: 5%;
    animation-delay: 0s;
}

.shape-2 {
    width: 60px;
    height: 60px;
    top: 70%;
    right: 10%;
    animation-delay: 5s;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.shape-3 {
    width: 100px;
    height: 100px;
    top: 40%;
    right: 20%;
    animation-delay: 10s;
    border-radius: 20px;
    transform: rotate(45deg);
}

.shape-4 {
    width: 50px;
    height: 50px;
    bottom: 30%;
    left: 15%;
    animation-delay: 15s;
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

@keyframes shapeFloat {
    0%, 100% { 
        transform: translateY(0px) rotate(0deg) scale(1); 
    }
    25% { 
        transform: translateY(-30px) rotate(90deg) scale(1.1); 
    }
    50% { 
        transform: translateY(-60px) rotate(180deg) scale(1); 
    }
    75% { 
        transform: translateY(-30px) rotate(270deg) scale(0.9); 
    }
}

.particle-container {
    position: absolute;
    width: 100%;
    height: 100%;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
    opacity: 0.2;
    animation: particleFloat 8s infinite linear;
}

.particle-1 { top: 10%; left: 20%; animation-delay: 0s; }
.particle-2 { top: 30%; left: 80%; animation-delay: 1.3s; }
.particle-3 { top: 60%; left: 10%; animation-delay: 2.6s; }
.particle-4 { top: 80%; left: 70%; animation-delay: 4s; }
.particle-5 { top: 20%; left: 60%; animation-delay: 5.3s; }
.particle-6 { top: 50%; left: 40%; animation-delay: 6.6s; }

@keyframes particleFloat {
    0% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 0.2;
    }
    90% {
        opacity: 0.2;
    }
    100% {
        transform: translateY(-100vh) translateX(100px) scale(0);
        opacity: 0;
    }
}

/* ==========================================================================
   LEAF FALLING ANIMATION
   ========================================================================== */
.leaf-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.leaf {
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    opacity: 0.4;
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 50% 75%, 18% 100%, 0% 38%);
    animation: leafFall 12s linear infinite;
}

@keyframes leafFall {
    0% {
        transform: translateY(-10vh) translateX(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.4;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(110vh) translateX(100px) rotate(360deg);
        opacity: 0;
    }
}

.leaf-1 { left: 10%; animation-delay: 0s; animation-duration: 10s; }
.leaf-2 { left: 20%; animation-delay: 2s; animation-duration: 12s; }
.leaf-3 { left: 35%; animation-delay: 4s; animation-duration: 11s; }
.leaf-4 { left: 50%; animation-delay: 1s; animation-duration: 13s; }
.leaf-5 { left: 65%; animation-delay: 3s; animation-duration: 10.5s; }
.leaf-6 { left: 75%; animation-delay: 5s; animation-duration: 12.5s; }
.leaf-7 { left: 85%; animation-delay: 1.5s; animation-duration: 11.5s; }
.leaf-8 { left: 95%; animation-delay: 3.5s; animation-duration: 13.5s; }

/* ==========================================================================
   MAIN CONTAINER
   ========================================================================== */
.header {
    text-align: center;
    margin-bottom: 20px;
    margin-top: 20px;
    position: relative;
    z-index: 2;
}

.logo {
    max-width: 200px;
    width: 100%;
    height: auto;
    margin-bottom: 20px;
    border-radius: 10px;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
}

.logo:hover {
    transform: scale(1.05) translateY(-5px);
}

.container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 40px;
    max-width: 900px;
    width: 100%;
    box-shadow: var(--shadow-strong);
    position: relative;
    z-index: 1;
    border: 1px solid rgba(165, 42, 42, 0.1);
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    background-size: 200% 100%;
    animation: shimmer 3s linear infinite;
    border-radius: 20px 20px 0 0;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 30px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

/* ==========================================================================
   WHEEL SECTION
   ========================================================================== */
.wheel-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.wheel-container {
    position: relative;
    width: 550px;
    height: 550px;
    margin-bottom: 30px;
    max-width: 100%;
}

#wheelCanvas {
    width: 100%;
    height: 100%;
    transition: transform 4s cubic-bezier(0.17, 0.67, 0.12, 0.99);
    cursor: pointer;
    filter: drop-shadow(0 10px 30px rgba(165, 42, 42, 0.3));
}

#wheelCanvas:hover {
    filter: drop-shadow(0 10px 30px rgba(165, 42, 42, 0.3)) brightness(1.05);
}

.pointer {
    position: absolute;
    top: 50%;
    right: -25px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 25px solid transparent;
    border-bottom: 25px solid transparent;
    border-right: 50px solid var(--primary-color);
    filter: drop-shadow(-2px 0 4px rgba(0, 0, 0, 0.3));
    z-index: 10;
    animation: pointerPulse 2s ease-in-out infinite;
}

@keyframes pointerPulse {
    0%, 100% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.1); }
}

.spin-button {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    padding: 18px 60px;
    font-size: 1.4em;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-medium);
    position: relative;
    overflow: hidden;
}

.spin-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.6s ease;
}

.spin-button:hover::before {
    width: 300px;
    height: 300px;
}

.spin-button:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: var(--shadow-strong);
}

.spin-button:active {
    transform: translateY(-2px) scale(0.98);
}

.spin-button:disabled {
    background: linear-gradient(135deg, #ccc 0%, #999 100%);
    cursor: not-allowed;
    transform: scale(1);
    opacity: 0.6;
}

/* ==========================================================================
   INPUT SECTION
   ========================================================================== */
.input-section {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 600px;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#nameInput {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    font-size: 1em;
    outline: none;
    transition: var(--transition-smooth);
    background: rgba(255, 255, 255, 0.9);
}

#nameInput:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 15px rgba(165, 42, 42, 0.2);
    background: white;
}

.add-button {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-soft);
}

.add-button:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
}

.add-button:active {
    transform: translateY(0);
}

/* ==========================================================================
   NAMES LIST
   ========================================================================== */
.names-list {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    padding: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.names-list::-webkit-scrollbar {
    width: 6px;
}

.names-list::-webkit-scrollbar-track {
    background: rgba(165, 42, 42, 0.1);
    border-radius: 3px;
}

.names-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.names-list h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.name-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(249, 249, 249, 0.9);
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
    transition: var(--transition-smooth);
}

.name-item:hover {
    background: white;
    transform: translateX(5px);
    box-shadow: var(--shadow-soft);
}

.delete-button {
    background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
    color: white;
    border: none;
    padding: 5px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: var(--transition-smooth);
}

.delete-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(255, 68, 68, 0.3);
}

/* ==========================================================================
   WINNER DISPLAY
   ========================================================================== */
.winner-display {
    text-align: center;
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 10px;
    font-size: 1.5em;
    font-weight: bold;
    display: none;
    animation: slideDown 0.5s ease-out;
    box-shadow: var(--shadow-medium);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   MODAL
   ========================================================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
    margin: 10% auto;
    padding: 40px;
    border: 3px solid var(--primary-color);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    text-align: center;
    box-shadow: var(--shadow-strong);
    animation: slideIn 0.5s ease-out;
    position: relative;
    overflow: hidden;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    background-size: 200% 100%;
    animation: shimmer 3s linear infinite;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        transform: scale(0.7) translateY(-50px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    color: var(--primary-color);
    font-size: 2.5em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.winner-name {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--primary-color);
    margin: 30px 0;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: var(--shadow-medium);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.modal-question {
    font-size: 1.2em;
    color: #666;
    margin: 20px 0;
}

.modal-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}

.modal-button {
    padding: 15px 40px;
    font-size: 1.1em;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
}

.modal-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.6s ease;
}

.modal-button:hover::before {
    width: 200px;
    height: 200px;
}

.modal-button.confirm {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.modal-button.confirm:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.modal-button.cancel {
    background: #ffffff;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.modal-button.cancel:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* ==========================================================================
   CONFETTI EFFECTS
   ========================================================================== */
.confetti {
    position: fixed;
    width: 15px;
    height: 15px;
    z-index: 999;
    pointer-events: none;
}

@keyframes confetti-fall {
    to {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ==========================================================================
   INFO & MISC
   ========================================================================== */
.info {
    text-align: center;
    color: #666;
    margin-top: 10px;
    font-size: 0.9em;
    font-style: italic;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 380px) {
    h1 {
        font-size: 1.3em;
    }

    .wheel-container {
        max-width: 280px;
    }

    .spin-button {
        font-size: 1em;
        padding: 10px 30px;
    }

    .logo {
        max-width: 160px;
    }

    .geometric-shape {
        display: none;
    }
} (max-width: 968px) {
    .container {
        padding: 30px 20px;
    }

    .wheel-container {
        width: 450px;
        height: 450px;
    }

    h1 {
        font-size: 2em;
    }

    .spin-button {
        padding: 15px 50px;
        font-size: 1.2em;
    }

    .modal-content {
        margin: 15% auto;
        padding: 30px 20px;
    }

    .winner-name {
        font-size: 2em;
    }

    .modal-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .modal-button {
        width: 100%;
    }

    .logo {
        max-width: 250px;
    }
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .header {
        margin-top: 10px;
        margin-bottom: 15px;
    }

    .logo {
        max-width: 200px;
        margin-bottom: 15px;
    }

    .container {
        padding: 20px 15px;
        border-radius: 15px;
    }

    h1 {
        font-size: 1.5em;
        margin-bottom: 20px;
    }

    .wheel-container {
        width: 100%;
        max-width: 320px;
        height: auto;
        aspect-ratio: 1;
        margin-bottom: 20px;
    }

    .pointer {
        right: -15px;
        border-top: 18px solid transparent;
        border-bottom: 18px solid transparent;
        border-right: 36px solid var(--primary-color);
    }

    .spin-button {
        padding: 12px 40px;
        font-size: 1.1em;
        width: 100%;
        max-width: 300px;
    }

    .input-section {
        max-width: 100%;
    }

    .input-group {
        flex-direction: column;
        gap: 10px;
    }

    #nameInput,
    .add-button {
        width: 100%;
        padding: 12px 15px;
    }

    .names-list {
        padding: 15px;
        max-height: 250px;
    }

    .modal-content {
        margin: 20% auto;
        padding: 25px 15px;
        width: 95%;
    }

    .modal-content h2 {
        font-size: 1.8em;
    }

    .winner-name {
        font-size: 1.6em;
        padding: 15px;
    }

    .modal-question {
        font-size: 1em;
    }

    .modal-button {
        padding: 12px 30px;
        font-size: 1em;
    }

    /* Hide some animations on mobile for performance */
    .leaf {
        display: none;
    }
}

@media