/* ========== RESET Y VARIABLES ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #ff6b35;
    --primary-dark: #e85d2c;
    --primary-light: #ff8c5a;
    --secondary: #2d2d3f;
    --dark: #12121a;
    --darker: #0a0a0f;
    --card-bg: rgba(30, 30, 45, 0.95);
    --text: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --rarity-common: #6b7280;
    --rarity-rare: #3b82f6;
    --rarity-epic: #8b5cf6;
    --rarity-legendary: #f59e0b;
    --gradient-primary: linear-gradient(135deg, #ff6b35, #ff8c5a);
    --gradient-dark: linear-gradient(135deg, #1a1a2e, #0f0f1a);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.05);
}

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    color: var(--text);
    overflow-x: hidden;
    padding-top: 70px;
    position: relative;
    min-height: 100vh;
}

/* ========== FONDO DE FUEGO ANIMADO ========== */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 50% 50%, #1a0a0a 0%, #0a0a0f 100%);
    z-index: -3;
}

.fire-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    overflow: hidden;
    pointer-events: none;
}

.fire-particle {
    position: absolute;
    bottom: -50px;
    background: radial-gradient(circle, #ff6b35, #ff8c5a, #ffaa00, transparent);
    border-radius: 50%;
    opacity: 0;
    animation: fireRise linear infinite;
    box-shadow: 0 0 8px rgba(255, 107, 53, 0.5);
}

@keyframes fireRise {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 0.9;
    }
    30% {
        opacity: 0.7;
    }
    60% {
        opacity: 0.4;
    }
    100% {
        transform: translateY(-100vh) scale(0);
        opacity: 0;
    }
}

/* Llamas inferiores */
.flame-base {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 250px;
    background: linear-gradient(to top, rgba(255, 107, 53, 0.2), transparent);
    pointer-events: none;
    z-index: -1;
}

.flame {
    position: absolute;
    bottom: 0;
    background: radial-gradient(ellipse at center, rgba(255, 107, 53, 0.5), rgba(255, 140, 90, 0.2), transparent);
    border-radius: 50%;
    filter: blur(25px);
    animation: flicker 2.5s ease-in-out infinite;
}

.flame:nth-child(1) {
    left: 5%;
    width: 120px;
    height: 180px;
    animation-delay: 0s;
}

.flame:nth-child(2) {
    left: 18%;
    width: 80px;
    height: 130px;
    animation-delay: 0.4s;
}

.flame:nth-child(3) {
    left: 32%;
    width: 150px;
    height: 220px;
    animation-delay: 0.8s;
}

.flame:nth-child(4) {
    left: 48%;
    width: 100px;
    height: 160px;
    animation-delay: 0.2s;
}

.flame:nth-child(5) {
    left: 62%;
    width: 130px;
    height: 200px;
    animation-delay: 1s;
}

.flame:nth-child(6) {
    left: 78%;
    width: 90px;
    height: 140px;
    animation-delay: 0.6s;
}

.flame:nth-child(7) {
    left: 92%;
    width: 110px;
    height: 170px;
    animation-delay: 0.3s;
}

@keyframes flicker {
    0%, 100% {
        opacity: 0.3;
        transform: scaleY(1) scaleX(1);
    }
    25% {
        opacity: 0.5;
        transform: scaleY(1.15) scaleX(1.05);
    }
    50% {
        opacity: 0.2;
        transform: scaleY(0.9) scaleX(0.95);
    }
    75% {
        opacity: 0.4;
        transform: scaleY(1.1) scaleX(1.02);
    }
}

.bottom-glow {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: linear-gradient(to top, rgba(255, 107, 53, 0.25), transparent);
    pointer-events: none;
    z-index: -1;
}

/* ========== NAVBAR SUPERIOR ========== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    z-index: 1000;
    padding: 0 20px;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

/* Logo */
.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: transform 0.2s;
}

.nav-logo:hover {
    transform: scale(1.02);
}

.logo-icon {
    font-size: 28px;
}

.logo-text {
    font-size: 20px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Menú principal */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    background: var(--glass-bg);
    padding: 6px;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: 40px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.nav-item.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.nav-icon {
    font-size: 18px;
}

.nav-badge {
    position: absolute;
    top: -6px;
    right: 8px;
    background: var(--primary);
    padding: 2px 6px;
    border-radius: 20px;
    font-size: 9px;
    font-weight: 700;
    color: white;
}

.nav-badge.new {
    background: var(--success);
}

/* Panel derecho */
.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* ========== BOTÓN DE RECOMPENSA HORARIA ========== */
.hourly-reward-btn {
    background: linear-gradient(135deg, #2d2d3f, #1a1a2e);
    border: 1px solid rgba(255, 215, 0, 0.3);
    padding: 8px 16px;
    border-radius: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.hourly-reward-btn:hover {
    background: linear-gradient(135deg, #3d3d4f, #2a2a3e);
    border-color: #ffd700;
    transform: scale(1.02);
}

.hourly-reward-btn.ready {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: #ffd700;
    animation: pulseReady 1.5s ease-in-out infinite;
}

@keyframes pulseReady {
    0%, 100% {
        box-shadow: 0 0 0px rgba(16, 185, 129, 0.4);
    }
    50% {
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.8);
    }
}

.reward-icon {
    font-size: 18px;
}

.reward-time {
    font-size: 13px;
    font-weight: 600;
    font-family: monospace;
    letter-spacing: 1px;
}

.hourly-reward-btn.ready .reward-time {
    color: #ffd700;
}

/* Balance */
.balance-card {
    display: flex;
    align-items: baseline;
    gap: 4px;
    background: var(--glass-bg);
    padding: 8px 16px;
    border-radius: 40px;
    border: 1px solid var(--glass-border);
}

.balance-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 500;
}

.balance-value {
    font-size: 18px;
    font-weight: 700;
    color: #ffd700;
}

.balance-currency {
    font-size: 12px;
    font-weight: 600;
    color: #ffd700;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--glass-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--glass-border);
}

.user-avatar:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

/* ========== MAIN CONTENT ========== */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 24px 60px;
    min-height: calc(100vh - 70px);
}

.section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    margin-bottom: 32px;
    text-align: center;
}

.section-header h2 {
    font-size: 32px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 8px;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 15px;
}

/* ========== CASES GRID ========== */
.cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
}

.case-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
}

.case-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
    transition: left 0.5s;
}

.case-card:hover::before {
    left: 100%;
}

.case-card:hover {
    transform: translateY(-6px);
    border-color: var(--primary);
    box-shadow: 0 20px 40px rgba(255, 107, 53, 0.15);
}

.case-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.3);
}

.case-emoji {
    font-size: 56px;
    margin-bottom: 16px;
}

.case-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.case-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.case-price {
    font-size: 14px;
    color: #ffd700;
    font-weight: 600;
}

/* ========== ÁREA DE APERTURA ========== */
.case-opening-area {
    text-align: center;
    padding: 48px;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.05), rgba(0, 0, 0, 0.2));
    border-radius: 32px;
    border: 1px solid var(--glass-border);
}

.chest-container {
    position: relative;
    display: inline-block;
}

.chest-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(255, 107, 53, 0.2), transparent);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s;
}

.chest-container:hover .chest-glow {
    opacity: 1;
}

.chest {
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, #2a2a3e, #1a1a2e);
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 107, 53, 0.5);
    position: relative;
    z-index: 1;
}

.chest:hover {
    transform: scale(1.05);
    border-color: var(--primary);
}

.chest:active {
    transform: scale(0.95);
}

.chest-emoji {
    font-size: 72px;
}

.chest.opening {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(-10px) rotate(-8deg); }
    75% { transform: translateX(10px) rotate(8deg); }
}

.open-case-btn {
    background: var(--gradient-primary);
    border: none;
    padding: 14px 40px;
    font-size: 18px;
    font-weight: 700;
    border-radius: 50px;
    color: white;
    cursor: pointer;
    margin-top: 32px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    box-shadow: 0 5px 20px rgba(255, 107, 53, 0.4);
}

.open-case-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 30px rgba(255, 107, 53, 0.6);
}

/* ========== RESULTADO ========== */
.result {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 28px;
    margin-top: 32px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    animation: slideUp 0.4s ease;
    border: 1px solid var(--glass-border);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== RAREZAS ========== */
.rareza-comun { color: var(--rarity-common); }
.rareza-rara { color: var(--rarity-rare); }
.rareza-epica { color: var(--rarity-epic); }
.rareza-legendaria { color: var(--rarity-legendary); }

/* ========== INVENTARIO ========== */
.inventory-stats-bar {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 28px;
    background: var(--card-bg);
    border-radius: 20px;
    padding: 20px 24px;
    border: 1px solid var(--glass-border);
}

.inventory-stat {
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 14px;
}

.inventory-stat strong {
    font-size: 20px;
    margin-left: 8px;
    color: #ffd700;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    max-height: 450px;
    overflow-y: auto;
    margin-bottom: 28px;
}

.inventory-grid::-webkit-scrollbar {
    width: 6px;
}

.inventory-grid::-webkit-scrollbar-track {
    background: var(--glass-bg);
    border-radius: 10px;
}

.inventory-grid::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.inventory-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.inventory-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--glass-border);
}

.delete-item {
    background: rgba(239, 68, 68, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.delete-item:hover {
    background: var(--danger);
    transform: scale(1.05);
}

.inventory-actions {
    display: flex;
    justify-content: center;
}

.reset-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 12px 28px;
    border-radius: 40px;
    color: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    font-weight: 500;
}

.reset-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger);
}

/* ========== NOTIFICACIÓN ========== */
.notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    padding: 14px 24px;
    border-radius: 16px;
    border-left: 4px solid var(--success);
    transform: translateX(450px);
    transition: transform 0.3s ease;
    z-index: 1000;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.notification.show {
    transform: translateX(0);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
    .nav-menu {
        gap: 4px;
    }
    
    .nav-item {
        padding: 6px 14px;
    }
    
    .nav-text {
        font-size: 13px;
    }
}

@media (max-width: 900px) {
    .nav-menu {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(10, 10, 15, 0.98);
        backdrop-filter: blur(20px);
        border-radius: 0;
        padding: 12px 20px;
        justify-content: space-around;
        border-top: 1px solid var(--glass-border);
        z-index: 100;
    }
    
    .nav-item {
        flex-direction: column;
        padding: 8px 12px;
        gap: 4px;
    }
    
    .nav-text {
        font-size: 11px;
    }
    
    .nav-badge {
        top: 0px;
        right: 4px;
    }
    
    .nav-right .balance-label,
    .nav-right .balance-currency {
        display: none;
    }
    
    .balance-card {
        padding: 8px 12px;
    }
    
    .hourly-reward-btn {
        padding: 6px 12px;
    }
    
    .reward-time {
        font-size: 11px;
    }
    
    .reward-icon {
        font-size: 14px;
    }
    
    body {
        padding-bottom: 70px;
    }
    
    .main-content {
        padding: 20px 16px 80px;
    }
    
    .case-opening-area {
        padding: 24px;
    }
    
    .chest {
        width: 150px;
        height: 150px;
    }
    
    .chest-emoji {
        font-size: 50px;
    }
    
    .flame {
        display: none;
    }
}

@media (max-width: 600px) {
    .section-header h2 {
        font-size: 24px;
    }
    
    .cases-grid {
        grid-template-columns: 1fr;
    }
    
    .inventory-stats-bar {
        gap: 8px;
    }
    
    .inventory-stat {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .inventory-stat strong {
        font-size: 16px;
    }
    
    .hourly-reward-btn .reward-time {
        font-size: 10px;
    }
}