/* Design System & Variáveis CSS */
:root {
    --bg-color: #070514;
    --panel-bg: rgba(20, 16, 42, 0.65);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-color: #f3f4f6;
    --text-muted: #9ca3af;
    
    --neon-pink: #ff007f;
    --neon-cyan: #00f3ff;
    --neon-gold: #ffaa00;
    --neon-purple: #8b5cf6;
    --neon-green: #10b981;
    
    --glow-pink: 0 0 15px rgba(255, 0, 127, 0.4);
    --glow-cyan: 0 0 15px rgba(0, 243, 255, 0.4);
    --glow-gold: 0 0 15px rgba(255, 170, 0, 0.4);
    --glow-purple: 0 0 15px rgba(139, 92, 246, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background: radial-gradient(circle at center, #161233 0%, var(--bg-color) 100%);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    padding: 20px;
}

/* Confetti Overlay */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 99;
}

/* Cabeçalho */
header {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 40px;
}

.brand-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 3rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 4px;
    background: linear-gradient(135deg, #fff 20%, #d946ef 50%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 10px rgba(139, 92, 246, 0.3));
    margin-bottom: 5px;
}

.brand-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 3px;
}

/* Container Principal */
.app-container {
    width: 100%;
    max-width: 1100px;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 40px;
    align-items: start;
}

/* Painéis com Glassmorphism */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

/* Seção da Roleta */
.wheel-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.wheel-container {
    position: relative;
    width: 100%;
    max-width: 480px;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

/* Ponteiro indicador */
.wheel-pointer {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 40px;
    background: linear-gradient(135deg, var(--neon-pink), #e11d48);
    clip-path: polygon(50% 100%, 0 0, 100% 0);
    z-index: 10;
    filter: drop-shadow(0 4px 8px rgba(255, 0, 127, 0.6));
    transform-origin: 50% 0%;
    transition: transform 0.1s ease-out;
}

.wheel-pointer.tick {
    transform: translateX(-50%) rotate(-18deg);
}

#wheel-canvas {
    width: 100%;
    height: 100%;
    max-width: 480px;
    max-height: 480px;
    border-radius: 50%;
    filter: drop-shadow(0 0 25px rgba(139, 92, 246, 0.25));
}

/* Botão Girar Central */
.spin-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffd700 0%, #ff8800 100%);
    border: 5px solid #0d0b1a;
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    font-size: 15px;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(255, 136, 0, 0.6), inset 0 2px 3px rgba(255, 255, 255, 0.4);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.5px;
}

.spin-btn:hover:not(:disabled) {
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow: 0 0 35px rgba(255, 136, 0, 0.85), inset 0 2px 4px rgba(255, 255, 255, 0.6);
}

.spin-btn:active:not(:disabled) {
    transform: translate(-50%, -50%) scale(0.94);
}

.spin-btn:disabled {
    background: radial-gradient(circle, #4b5563 0%, #1f2937 100%);
    box-shadow: none;
    color: #9ca3af;
    cursor: not-allowed;
}

.spin-cost-info {
    font-size: 0.9rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 10px;
}

.spin-cost-info strong {
    color: var(--neon-gold);
}

/* Painel Lateral / Controle */
.control-section {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Carteira de Saldo */
.balance-card {
    background: linear-gradient(135deg, rgba(23, 17, 51, 0.95), rgba(11, 8, 26, 0.95));
    border: 2px solid var(--neon-gold);
    box-shadow: 0 0 25px rgba(255, 170, 0, 0.15);
    border-radius: 18px;
    padding: 22px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.balance-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 170, 0, 0.04) 0%, transparent 60%);
    pointer-events: none;
}

.balance-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 6px;
}

.balance-value-container {
    font-size: 2.6rem;
    font-weight: 900;
    color: var(--neon-gold);
    text-shadow: var(--glow-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s ease;
}

.balance-value-container.pulse {
    transform: scale(1.08);
}

.balance-value-container .currency {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    background: rgba(255, 170, 0, 0.15);
    padding: 3px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 170, 0, 0.25);
}

/* Loja Simulada */
.shop-section h3 {
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    color: var(--text-color);
    border-left: 3px solid var(--neon-purple);
    padding-left: 10px;
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.shop-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-color);
    padding: 12px 6px;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.shop-btn:hover {
    background: linear-gradient(135deg, var(--neon-purple), #d946ef);
    border-color: transparent;
    box-shadow: var(--glow-purple);
    transform: translateY(-2px);
}

.shop-btn:active {
    transform: translateY(0);
}

/* Seções de Histórico e Acumulados */
.panel-section h3 {
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    color: var(--text-color);
    border-left: 3px solid var(--neon-cyan);
    padding-left: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.clear-btn {
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
    transition: all 0.2s;
}

.clear-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

/* Lista de Últimos Prêmios */
.history-list {
    list-style: none;
    max-height: 180px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

/* Scrollbar Personalizada */
.history-list::-webkit-scrollbar, .coupons-container::-webkit-scrollbar {
    width: 6px;
}
.history-list::-webkit-scrollbar-track, .coupons-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.01);
    border-radius: 4px;
}
.history-list::-webkit-scrollbar-thumb, .coupons-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
.history-list::-webkit-scrollbar-thumb:hover, .coupons-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.history-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 10px 14px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    animation: itemSlideIn 0.3s ease-out;
}

@keyframes itemSlideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.history-item .timestamp {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.prize-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.prize-badge.discount {
    background: rgba(0, 243, 255, 0.12);
    color: var(--neon-cyan);
    border: 1px solid rgba(0, 243, 255, 0.25);
    box-shadow: 0 0 5px rgba(0, 243, 255, 0.1);
}

.prize-badge.mt {
    background: rgba(255, 170, 0, 0.12);
    color: var(--neon-gold);
    border: 1px solid rgba(255, 170, 0, 0.25);
    box-shadow: 0 0 5px rgba(255, 170, 0, 0.1);
}

.empty-msg {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    padding: 15px 0;
    font-style: italic;
}

/* Prêmios Acumulados */
.accumulated-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.summary-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 14px 10px;
    text-align: center;
}

.summary-card .title {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.summary-card .value {
    font-size: 1.4rem;
    font-weight: 800;
}

.summary-card.mt .value {
    color: var(--neon-gold);
    text-shadow: 0 0 10px rgba(255, 170, 0, 0.2);
}

.summary-card.discount .value {
    color: var(--neon-cyan);
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
}

/* Barra de Progresso do Desconto */
.discount-progress-container {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 18px 15px;
    margin-top: 15px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
}

.progress-bar-bg {
    background: rgba(255, 255, 255, 0.08);
    height: 16px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
    margin-top: 8px;
    margin-bottom: 12px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
}

.progress-text {
    color: var(--neon-cyan);
    text-shadow: 0 0 5px rgba(0, 243, 255, 0.3);
}

.use-coupon-btn {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--neon-cyan);
    background: rgba(0, 243, 255, 0.05);
    color: var(--neon-cyan);
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.use-coupon-btn:hover:not(:disabled) {
    background: var(--neon-cyan);
    color: #070514;
    box-shadow: var(--glow-cyan);
}

.use-coupon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

/* Modal de Vitória */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 2, 10, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    display: flex;
    opacity: 1;
}

.modal-box {
    background: linear-gradient(135deg, #181335 0%, #0a0718 100%);
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(139, 92, 246, 0.3);
    border-radius: 24px;
    padding: 40px;
    width: 90%;
    max-width: 440px;
    text-align: center;
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.modal-overlay.show .modal-box {
    transform: scale(1);
}

.modal-emoji {
    font-size: 4rem;
    margin-bottom: 15px;
    display: inline-block;
    animation: emojiPulse 1s infinite alternate;
}

@keyframes emojiPulse {
    from { transform: scale(1); }
    to { transform: scale(1.15); }
}

.modal-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #ffffff 40%, #ffaa00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-msg {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 24px;
    line-height: 1.5;
}

.modal-prize-box {
    font-size: 2.5rem;
    font-weight: 900;
    padding: 16px 20px;
    border-radius: 16px;
    margin-bottom: 25px;
    display: inline-block;
    letter-spacing: 1px;
}

.modal-prize-box.discount {
    background: rgba(0, 243, 255, 0.08);
    color: var(--neon-cyan);
    border: 2px solid var(--neon-cyan);
    box-shadow: var(--glow-cyan);
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.4);
}

.modal-prize-box.mt {
    background: rgba(255, 170, 0, 0.08);
    color: var(--neon-gold);
    border: 2px solid var(--neon-gold);
    box-shadow: var(--glow-gold);
    text-shadow: 0 0 10px rgba(255, 170, 0, 0.4);
}

.modal-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--neon-purple), #d946ef);
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(139, 92, 246, 0.35);
    transition: all 0.2s;
}

.modal-btn:hover {
    box-shadow: 0 5px 25px rgba(139, 92, 246, 0.6);
    transform: translateY(-2px);
}

.modal-btn:active {
    transform: translateY(0);
}

/* Responsividade */
@media (max-width: 900px) {
    .app-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    .wheel-container {
        max-width: 400px;
    }
    .brand-title {
        font-size: 2.3rem;
    }
}

/* Controles Adicionais de Jogo */
.wheel-controls {
    margin-top: 20px;
    width: 100%;
    max-width: 480px;
    padding: 20px !important;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.control-row {
    width: 100%;
}

/* Toggle Checkbox */
.toggle-control {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.toggle-control input {
    appearance: none;
    width: 40px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    position: relative;
    outline: none;
    cursor: pointer;
    transition: background 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toggle-control input:checked {
    background: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
}

.toggle-control input::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
}

.toggle-control input:checked::before {
    transform: translateX(20px);
}

.control-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Select Dropdown */
.control-select-el {
    background: #0d0b1a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-color);
    padding: 6px 12px;
    border-radius: 8px;
    outline: none;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
}

.control-select-el:focus {
    border-color: var(--neon-cyan);
    box-shadow: var(--glow-cyan);
}

/* Auto Spin Buttons */
.auto-spin-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.auto-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    padding: 8px;
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auto-btn:hover:not(:disabled) {
    background: rgba(0, 243, 255, 0.1);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: 0 0 8px rgba(0, 243, 255, 0.2);
}

.auto-btn.active-spin {
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    color: #fff;
    border-color: transparent;
    box-shadow: var(--glow-cyan);
    animation: pulse-glow 1.5s infinite;
}

.auto-btn.stop-btn {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.auto-btn.stop-btn:hover:not(:disabled) {
    background: #ef4444;
    color: #fff;
    border-color: transparent;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.auto-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    box-shadow: none;
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 5px rgba(0, 243, 255, 0.4); }
    50% { box-shadow: 0 0 15px rgba(0, 243, 255, 0.8); }
    100% { box-shadow: 0 0 5px rgba(0, 243, 255, 0.4); }
}

/* Toast Flutuante para Auto-Resgate */
.floating-toast {
    position: fixed;
    bottom: 15%;
    left: 50%;
    transform: translate(-50%, 50px);
    padding: 15px 30px;
    border-radius: 30px;
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    font-size: 1.8rem;
    z-index: 1000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    text-transform: uppercase;
}

.floating-toast.discount {
    background: linear-gradient(135deg, #0d0b1a 0%, #101835 100%);
    border: 2px solid var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: var(--glow-cyan);
}

.floating-toast.mt {
    background: linear-gradient(135deg, #0d0b1a 0%, #201710 100%);
    border: 2px solid var(--neon-gold);
    color: var(--neon-gold);
    box-shadow: var(--glow-gold);
}

.floating-toast.show-toast {
    opacity: 1;
    transform: translate(-50%, 0);
}
