/* ========================================
   RESET & BASE STYLES
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.9) 0%, rgba(118, 75, 162, 0.9) 100%),
                url('banner.png') center center / cover no-repeat fixed;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

/* ========================================
   HEADER
   ======================================== */
header {
    background: rgba(255, 255, 255, 0.95);
    padding: 1.5rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-logo {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-text {
    flex: 1;
}

header h1 {
    font-size: 1.75rem;
    color: #667eea;
    margin-bottom: 0.25rem;
}

header p {
    color: #666;
    font-size: 0.875rem;
    margin: 0;
}

/* ========================================
   PROMOTIONAL BANNER
   ======================================== */
.promo-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.promo-text {
    color: white;
    font-size: 1rem;
    font-weight: 500;
    margin: 0;
}

.promo-btn {
    background: white;
    color: #667eea;
    padding: 0.6rem 1.5rem;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.promo-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    background: #f8f8f8;
}

/* ========================================
   CONTAINER & LAYOUT
   ======================================== */
.container {
    display: flex;
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
    gap: 1rem;
    align-items: flex-start;
}

/* ========================================
   SIDE ADS (DESKTOP)
   ======================================== */
.side-ad {
    flex-shrink: 0;
    width: 160px;
    position: sticky;
    top: 2rem;
}

.left-ad {
    order: 1;
}

.right-ad {
    order: 3;
}

.ad-placeholder {
    background: #e0e0e0;
    padding: 2rem 1rem;
    text-align: center;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #666;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.main-content {
    flex: 1;
    order: 2;
    min-width: 0;
}

/* ========================================
   GAME SELECTION
   ======================================== */
.game-selection {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.selection-container h2 {
    color: #667eea;
    margin-bottom: 0.5rem;
    font-size: 1.75rem;
    text-align: center;
}

.selection-subtitle {
    color: #666;
    text-align: center;
    margin-bottom: 2rem;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.game-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.game-card:not(.disabled):hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
    border-color: #667eea;
}

.game-card.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.game-card.active .game-icon {
    font-size: 4rem;
}

.game-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f0f0f0;
}

.game-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.game-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.game-card p {
    font-size: 0.9rem;
    opacity: 0.8;
}

.game-card.active h3,
.game-card.active p {
    color: white;
}

/* ========================================
   ROULETTE GAME
   ======================================== */
.roulette-game {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.back-button {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
}

.back-button:hover {
    background: #5568d3;
    transform: translateX(-5px);
}

.roulette-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

/* ========================================
   ROULETTE DISPLAY (LEFT SIDE)
   ======================================== */
.roulette-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.roulette-title {
    color: #667eea;
    font-size: 1.75rem;
    text-align: center;
}

.wheel-container {
    position: relative;
    width: 400px;
    height: 400px;
}

#rouletteCanvas {
    width: 100%;
    height: 100%;
}

.pointer {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 35px solid #ff4444;
    z-index: 100;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
}

.spin-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 3rem;
    border-radius: 30px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.spin-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.spin-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spin-button.spinning .spin-text::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.result-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1.5rem 2rem;
    border-radius: 12px;
    margin-top: 1rem;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-content {
    text-align: center;
    color: white;
}

.result-label {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.result-text {
    font-size: 1.75rem;
    font-weight: bold;
}

/* ========================================
   OPTIONS PANEL (RIGHT SIDE)
   ======================================== */
.options-panel {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
}

.options-panel h3 {
    color: #667eea;
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.options-subtitle {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.title-input-group {
    margin-bottom: 1.5rem;
}

.title-input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.title-input-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.title-input-group input:focus {
    outline: none;
    border-color: #667eea;
}

.add-option-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.add-option-group input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.add-option-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-add {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-add:hover {
    background: #5568d3;
}

.options-counter {
    text-align: center;
    color: #667eea;
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.options-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.option-item {
    background: white;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

.option-item:hover {
    border-color: #667eea;
}

.option-color {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    flex-shrink: 0;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.option-text {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    padding: 0.25rem;
}

.option-text:focus {
    outline: none;
    background: #f8f9fa;
    border-radius: 4px;
}

.option-delete {
    background: #ff4444;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.option-delete:hover {
    background: #cc0000;
    transform: scale(1.1);
}

.options-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-secondary {
    flex: 1;
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    padding: 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

/* ========================================
   MOBILE BOTTOM AD
   ======================================== */
.mobile-ad-bottom {
    display: none;
    background: #f5f5f5;
    padding: 1rem;
    text-align: center;
    border-top: 1px solid #ddd;
}

/* ========================================
   FOOTER AD
   ======================================== */
.footer-ad {
    background: #f5f5f5;
    padding: 1rem;
    text-align: center;
    border-top: 1px solid #ddd;
    margin-top: 2rem;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 1024px) {
    .side-ad {
        display: none;
    }
    
    .mobile-ad-bottom {
        display: block;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    .roulette-container {
        grid-template-columns: 1fr;
    }
    
    .wheel-container {
        width: 100%;
        max-width: 350px;
        height: auto;
        aspect-ratio: 1;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
    }
    
    .roulette-game {
        padding: 1rem;
    }
    
    .wheel-container {
        max-width: 300px;
    }
    
    #rouletteCanvas {
        width: 100%;
        height: 100%;
    }
    
    .spin-button {
        padding: 0.75rem 2rem;
        font-size: 1.25rem;
    }
    
    /* Mobile: Stack add option input and button */
    .add-option-group {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .btn-add {
        width: 100%;
    }
    
    /* Mobile: Stack action buttons */
    .options-actions {
        flex-direction: column;
    }
    
    .btn-secondary {
        width: 100%;
    }
    
    /* Mobile: Adjust options panel */
    .options-panel {
        padding: 1rem;
    }
    
    .options-panel h3 {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    header {
        padding: 1rem;
    }
    
    .promo-banner {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .promo-text {
        font-size: 0.875rem;
        text-align: center;
    }
    
    .promo-btn {
        width: 100%;
        text-align: center;
    }
    
    .game-selection,
    .roulette-game {
        padding: 1rem;
    }
    
    .wheel-container {
        max-width: 280px;
    }
    
    /* Extra small screens: Even more compact */
    .options-panel {
        padding: 0.75rem;
    }
    
    .title-input-group input,
    .add-option-group input {
        font-size: 0.95rem;
        padding: 0.65rem;
    }
    
    .btn-add,
    .btn-secondary {
        padding: 0.65rem;
        font-size: 0.9rem;
    }
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */
.options-list::-webkit-scrollbar {
    width: 8px;
}

.options-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.options-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.options-list::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}
