@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap');

body { margin: 0; padding: 0; background-color: #020617; font-family: 'Poppins', sans-serif; overflow: hidden; display: flex; justify-content: center; align-items: center; height: 100vh; color: #ffffff; }

#game-wrapper { position: relative; width: 1536px; height: 1024px; overflow: hidden; background: #000; box-shadow: 0 0 100px rgba(0,0,0,0.8); }

canvas { image-rendering: pixelated; }

.gold-text { color: #facc15 !important; font-weight: bold; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.text-white-bold { color: #ffffff !important; font-weight: bold; }
.glass { background: rgba(15, 23, 42, 0.95); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.15); border-radius: 16px; padding: 15px; margin-bottom: 10px; width: 100%; box-sizing: border-box; }

#ui-overlay { position: absolute; top: 25px; left: 25px; width: 380px; z-index: 50; display: flex; flex-direction: column; }

/* MENU TOP RIGHT FISSO */
#top-right-menu { position: absolute; top: 25px; right: 25px; display: flex; gap: 15px; z-index: 1000; }
.menu-wrapper { position: relative; }
.menu-btn { width: 70px; height: 70px; background: #1e293b; border: 3px solid #334155; border-radius: 18px; font-size: 32px; cursor: pointer; color: white; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.menu-btn:hover { background: #334155; transform: scale(1.05); }
.notify-dot { position: absolute; top: -5px; right: -5px; width: 20px; height: 20px; background: #ef4444; border-radius: 50%; border: 3px solid #020617; display: none; animation: pulse 2s infinite; }

/* ISTRUZIONI */
.instructions-content { max-height: 600px; overflow-y: auto; padding-right: 10px; }
.instructions-content::-webkit-scrollbar { width: 8px; }
.instructions-content::-webkit-scrollbar-track { background: #0f172a; border-radius: 4px; }
.instructions-content::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
.instructions-content::-webkit-scrollbar-thumb:hover { background: #475569; }
.instruction-section { margin-bottom: 20px; padding: 15px; background: rgba(30, 41, 59, 0.5); border-radius: 12px; border-left: 4px solid #facc15; }
.instruction-section h3 { color: #facc15; margin: 0 0 10px 0; font-size: 18px; }
.instruction-section p { color: #e2e8f0; font-size: 14px; line-height: 1.6; margin: 8px 0; }
.instruction-section ul { color: #cbd5e1; font-size: 13px; margin: 8px 0; padding-left: 20px; }
.instruction-section li { margin: 5px 0; line-height: 1.5; }
.zoom-warning { background: rgba(239, 68, 68, 0.2); border: 2px solid #ef4444; border-radius: 12px; padding: 12px; margin-bottom: 20px; text-align: center; }
.zoom-warning p { color: #fecaca; font-size: 13px; font-weight: bold; margin: 5px 0; }
.instruction-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.instruction-item { background: #1e293b; padding: 10px; border-radius: 8px; text-align: center; border: 2px solid #334155; }
.instruction-item .emoji { font-size: 28px; margin-bottom: 5px; }
.instruction-item .label { font-size: 11px; color: #94a3b8; font-weight: bold; }

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

/* MODALS E X A DESTRA */
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.85); display: none; z-index: 2000; justify-content: center; align-items: center; }
.modal { width: 95%; max-width: 440px; padding: 25px; border: 2px solid rgba(255,255,255,0.1); position: relative; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; width: 100%; }
.close-btn { background: transparent !important; color: #94a3b8; border: none; font-size: 32px; cursor: pointer; order: 2; transition: 0.2s; }
.close-btn:hover { color: #fff; transform: rotate(90deg); }

/* GRIGLIE TABELLARI */
.grid-container { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 100%; }
.item-box { background: #1e293b; border: 2px solid #334155; border-radius: 12px; padding: 12px 4px; display: flex; flex-direction: column; align-items: center; text-align: center; transition: 0.3s; }
.item-box .label { font-size: 9px; color: #94a3b8; }
.item-box .val { font-size: 11px; font-weight: bold; margin: 4px 0; color: #fff; }
.item-box .price { font-size: 10px; color: #facc15; }
.item-box.active:hover { border-color: #facc15; background: rgba(250, 204, 21, 0.2); cursor: pointer; transform: scale(1.05); }
.item-box.active-reward { border-color: #facc15; background: rgba(250, 204, 21, 0.2); box-shadow: 0 0 15px #facc15; animation: pulse 2s infinite; }
.item-box.claimed { opacity: 0.3; border-color: #16a34a; text-decoration: line-through; }

/* BATTAGLIA ABBASSATA AL BORDO */
#battle-ui { position: absolute; inset: 0; z-index: 200; background: rgba(0,0,0,0.4); display: none; }
.battle-screen { position: relative; width: 100%; height: 100%; }
.hp-plate { position: absolute; background: rgba(0,0,0,0.9); padding: 12px; border-radius: 12px; border: 2px solid #facc15; width: 220px; }
.hp-plate.enemy { top: 30px; right: 40px; }
.hp-plate.player { 
    bottom: 115px; /* Alzata per il banner più basso */
    left: 40px; 
}
.hp-bar-wrap { background: #333; height: 12px; border-radius: 6px; margin-top: 6px; overflow: hidden; }
.hp-fill { background: #22c55e; width: 100%; height: 100%; transition: width 0.5s; }
.battle-stats-text { font-size: 10px; color: #cbd5e1; margin-top: 5px; text-align: center; font-weight: bold; }

.battle-controls { 
    position: absolute; 
    bottom: 0; 
    left: 0; 
    right: 0; 
    height: 110px; /* Ridotto da 120px */
    padding: 8px 20px 12px 20px;
    border-top: 4px solid #facc15; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: flex-start; 
    z-index: 300; 
}

#battle-msg { 
    font-size: 15px; /* Leggermente ridotto */
    padding-top: 5px; 
    margin-bottom: 8px;
    min-height: 20px;
    text-align: center;
}

/* GRIGLIA BOTTONI - 4 COLONNE IN UNA RIGA */
.atk-grid { 
    display: grid; 
    grid-template-columns: repeat(4, 1fr); /* 4 colonne invece di 2 */
    gap: 8px; 
    width: 100%; 
    max-width: 1200px; /* Limite larghezza per non allungarli troppo */
}
.atk-btn-blue { 
    background: #2563eb; 
    color: white; 
    padding: 10px 6px; /* Padding ridotto */
    border: none; 
    border-radius: 8px; 
    font-weight: bold; 
    cursor: pointer; 
    font-size: 14px; /* Leggermente ridotto */
    border-bottom: 4px solid #1e40af; 
    transition: 0.2s; 
    line-height: 1.2;
}
.atk-btn-blue:hover:not(:disabled) { 
    background: #1d4ed8; 
    transform: translateY(-2px); 
}
.atk-btn-blue:active:not(:disabled) { 
    transform: translateY(0); 
    border-bottom-width: 2px; 
}

.atk-btn-blue:disabled { 
    opacity: 0.5; 
    cursor: not-allowed; 
}

.atk-btn-blue small { 
    display: block; 
    font-size: 10px;
    opacity: 0.9; 
    font-weight: normal; 
    margin-top: 2px;
}
.atk-btn-grey { 
    background: #475569; 
    color: white; 
    padding: 10px 6px; 
    border: none; 
    border-radius: 8px; 
    font-weight: bold; 
    cursor: pointer; 
    font-size: 14px;
    transition: 0.2s; 
}

.atk-btn-grey:hover { 
    background: #64748b; 
    transform: translateY(-2px);
}


/* LEGENDA ELEMENTI */
#element-legend { 
    position: absolute; 
    top: 25px; 
    left: 25px;
    z-index: 250; 
    padding: 12px 15px;
    display: none; 
    width: 200px;
    box-sizing: border-box;
}

#element-legend h4 {
    margin: 0 0 8px 0;
    font-size: 12px;
}

#element-legend p {
    margin: 3px 0;
    font-size: 11px;
    line-height: 1.3;
}

#element-legend small {
    font-size: 10px;
}
/* SIDEBAR REGOLE */
.sidebar-item { margin-bottom: 12px; }
.equip-text-green { font-size: 11px; color: #22c55e !important; font-weight: bold; margin-top: 4px; text-transform: uppercase; }
.food-row { display: flex; justify-content: space-between; align-items: center; }
.timer-badge { font-size: 11px; color: #f8fafc; font-family: monospace; background: rgba(0,0,0,0.5); padding: 3px 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.1); }
.sel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sel-btn { width: 100%; height: 50px; border-radius: 12px; background: #1e293b; color: white; border: 2px solid #334155; cursor: pointer; font-weight: bold; transition: 0.2s; font-size: 20px; }
.sel-btn.active { background: #facc15; color: #000; border-color: #facc15; }
.sel-btn:hover:not(:disabled) { transform: scale(1.05); }
.sel-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.feed-btn { width: 100%; padding: 16px; border-radius: 12px; font-weight: bold; background: #ea580c; color: white; border: none; cursor: pointer; font-size: 16px; border-bottom: 5px solid #9a3412; transition: 0.2s; }
.feed-btn:hover { background: #dc2626; transform: translateY(-2px); }
.feed-btn:active { transform: translateY(0); border-bottom-width: 2px; }
.btn-plus { background: #16a34a; color: white; border-radius: 6px; width: 32px; height: 32px; font-weight: bold; border: none; cursor: pointer; font-size: 20px; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.btn-plus:hover { background: #15803d; transform: scale(1.1); }
.stat-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.points-text { color: #facc15; font-weight: bold; margin-top: 10px; text-align: center; }

/* LOGIN */
#login-overlay { position: absolute; inset: 0; background: #020617; display: flex; justify-content: center; align-items: center; z-index: 5000; }
.login-box { text-align: center; width: 340px; }
.login-form { display: flex; flex-direction: column; gap: 15px; width: 100%; }
.login-box input { padding: 14px; border-radius: 10px; background: #0f172a; color: white; border: 1px solid #334155; font-size: 16px; transition: 0.2s; }
.login-box input:focus { outline: none; border-color: #facc15; box-shadow: 0 0 10px rgba(250, 204, 21, 0.3); }
.action-btn-gold { width: 100%; padding: 16px; border-radius: 12px; font-weight: bold; background: #facc15; color: #000; border: none; cursor: pointer; font-size: 18px; transition: 0.2s; border-bottom: 5px solid #ca8a04; }
.action-btn-gold:hover { background: #fbbf24; transform: translateY(-2px); }
.action-btn-gold:active { transform: translateY(0); border-bottom-width: 2px; }
/* AGGIUNGI questo CSS al tuo style.css (dopo le righe esistenti del login) */

/* LOGIN TABS */
.login-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #334155;
}

.login-tab {
    flex: 1;
    padding: 12px 20px;
    background: #0f172a;
    color: #94a3b8;
    border: none;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.login-tab:hover {
    background: #1e293b;
    color: #e2e8f0;
}

.login-tab.active {
    background: linear-gradient(135deg, #facc15 0%, #f59e0b 100%);
    color: #000;
}

/* REGISTER INFO BOX */
.register-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid #3b82f6;
    border-radius: 10px;
    padding: 12px;
    text-align: left;
    margin-bottom: 5px;
}

.register-info p {
    color: #facc15;
    font-size: 14px;
    font-weight: bold;
    margin: 0 0 8px 0;
}

.register-info ul {
    color: #cbd5e1;
    font-size: 12px;
    margin: 0;
    padding-left: 20px;
}

.register-info li {
    margin: 4px 0;
}

/* MATITA EDIT TRASPARENTE */
.btn-edit-icon { background: transparent !important; border: none; color: #ffffff; cursor: pointer; font-size: 20px; display: flex; align-items: center; justify-content: center; opacity: 0.6; transition: 0.2s; }
.btn-edit-icon:hover { opacity: 1; transform: scale(1.2); }

.small-title { color: #94a3b8; font-size: 12px; margin: 0 0 8px 0; text-transform: uppercase; letter-spacing: 1px; }
.lvl-badge { background: #facc15; color: #000; padding: 3px 10px; border-radius: 10px; font-weight: bold; font-size: 12px; }
.xp-bar-container { background: #0f172a; height: 10px; border-radius: 5px; margin-top: 10px; overflow: hidden; border: 1px solid rgba(255,255,255,0.1); width: 100%; }
.xp-bar-fill { background: linear-gradient(90deg, #3b82f6, #60a5fa); height: 100%; transition: width 0.4s ease; width: 0%; }
.info-row { display: flex; justify-content: space-between; margin-top: 10px; }

#notification-container { position: absolute; top: 100px; right: 25px; z-index: 9999; pointer-events: none; width: 350px; display: flex; flex-direction: column; align-items: flex-end; }
.toast { background: rgba(30, 41, 59, 0.96); padding: 15px 25px; border-radius: 12px; margin-bottom: 10px; color: white; font-weight: bold; border-right: 6px solid #facc15; box-shadow: 0 10px 20px rgba(0,0,0,0.5); animation: slideIn 0.4s ease; }
.toast-player { border-right-color: #22c55e; }
.toast-dragon { border-right-color: #ef4444; }

@keyframes slideIn { from { transform: translateX(120%); } to { transform: translateX(0); } }
/* CHAT TOGGLE BUTTON */
.chat-toggle {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 70px;
    height: 70px;
    background: #1e293b;
    border: 3px solid #334155;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 8000;
    transition: 0.3s;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.chat-toggle:hover {
    background: #334155;
    transform: scale(1.1);
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid #020617;
    animation: pulse 2s infinite;
}

/* CHAT CONTAINER */
.chat-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 400px;
    height: 600px;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(12px);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 16px;
    z-index: 8000;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(0,0,0,0.7);
}

.chat-header {
    padding: 15px 20px;
    border-bottom: 2px solid #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-close-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 28px;
    cursor: pointer;
    transition: 0.2s;
    padding: 0;
    width: 30px;
    height: 30px;
}

.chat-close-btn:hover {
    color: #fff;
    transform: rotate(90deg);
}

/* TABS */
.chat-tabs {
    display: flex;
    border-bottom: 2px solid #334155;
}

.chat-tab {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: 0.2s;
    border-bottom: 3px solid transparent;
}

.chat-tab:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.chat-tab.active {
    color: #facc15;
    border-bottom-color: #facc15;
}

.chat-tab-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* MESSAGGI */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #0f172a;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

.chat-message {
    background: rgba(30, 41, 59, 0.6);
    padding: 10px 12px;
    border-radius: 12px;
    border-left: 3px solid #3b82f6;
}

.chat-message.my-message {
    background: rgba(250, 204, 21, 0.15);
    border-left-color: #facc15;
}

.chat-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.chat-user {
    color: #3b82f6;
    font-weight: bold;
    font-size: 13px;
}

.chat-user-me {
    color: #facc15;
}

.chat-level {
    background: #334155;
    color: #94a3b8;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: bold;
}

.chat-time {
    color: #64748b;
    font-size: 11px;
    margin-left: auto;
}

.chat-message-text {
    color: #e2e8f0;
    font-size: 14px;
    word-wrap: break-word;
    line-height: 1.4;
}

/* INPUT */
.chat-input-container {
    padding: 15px;
    border-top: 2px solid #334155;
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 12px 15px;
    color: white;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
}

.chat-input:focus {
    outline: none;
    border-color: #facc15;
    box-shadow: 0 0 10px rgba(250, 204, 21, 0.3);
}

.chat-send-btn {
    background: #facc15;
    border: none;
    border-radius: 10px;
    width: 45px;
    height: 45px;
    color: #000;
    font-size: 20px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.chat-send-btn:hover {
    background: #fbbf24;
    transform: scale(1.1);
}

.chat-send-btn:active {
    transform: scale(0.95);
}

/* ONLINE LIST */
.online-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.online-player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(30, 41, 59, 0.6);
    border-radius: 10px;
    border-left: 3px solid #22c55e;
}

.online-dot {
    width: 10px;
    height: 10px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 10px #22c55e;
    animation: pulse 2s infinite;
}

.online-name {
    color: #e2e8f0;
    font-weight: bold;
    flex: 1;
}

.online-level {
    background: #334155;
    color: #94a3b8;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
}

/* RESPONSIVE per schermi più piccoli */
@media (max-width: 1600px) {
    .chat-container {
        width: 350px;
        height: 500px;
    }
}

/* SCHERMATA RISULTATO BATTAGLIA */
.battle-result-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.battle-result-card {
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(12px);
    border: 3px solid #facc15;
    border-radius: 20px;
    padding: 40px;
    width: 90%;
    max-width: 600px;
    text-align: center;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8);
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.battle-result-card.victory {
    border-color: #22c55e;
    box-shadow: 0 10px 50px rgba(34, 197, 94, 0.4);
}

.battle-result-card.defeat {
    border-color: #ef4444;
    box-shadow: 0 10px 50px rgba(239, 68, 68, 0.4);
}

.result-title {
    font-size: 56px;
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: 0 4px 20px currentColor;
    animation: pulse 2s infinite;
}

.result-title.victory {
    color: #22c55e;
}

.result-title.defeat {
    color: #ef4444;
}

.result-subtitle {
    color: #94a3b8;
    font-size: 18px;
    margin-bottom: 30px;
}

.battle-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(30, 41, 59, 0.8);
    padding: 20px;
    border-radius: 12px;
    border: 2px solid #334155;
}

.stat-card h4 {
    color: #facc15;
    font-size: 14px;
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-card .big-number {
    font-size: 36px;
    font-weight: bold;
    color: white;
    margin: 10px 0;
}

.stat-card .detail {
    font-size: 13px;
    color: #94a3b8;
    margin: 5px 0;
}

.rewards-section {
    background: rgba(250, 204, 21, 0.1);
    border: 2px solid #facc15;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
}

.rewards-section h3 {
    color: #facc15;
    font-size: 20px;
    margin: 0 0 15px 0;
}

.rewards-list {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.reward-item {
    font-size: 28px;
    font-weight: bold;
    color: white;
}

.reward-item.positive {
    color: #22c55e;
}

.reward-item.negative {
    color: #ef4444;
}

.continue-btn {
    width: 100%;
    padding: 18px;
    background: #facc15;
    color: #000;
    border: none;
    border-radius: 12px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    border-bottom: 5px solid #ca8a04;
    text-transform: uppercase;
}

.continue-btn:hover {
    background: #fbbf24;
    transform: translateY(-2px);
}

.continue-btn:active {
    transform: translateY(0);
    border-bottom-width: 2px;
}
/* ACHIEVEMENTS SYSTEM */
.achievement-tabs {
    display: flex;
    border-bottom: 2px solid #334155;
    margin-bottom: 0;
}

.achievement-tab {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: 0.2s;
    border-bottom: 3px solid transparent;
    font-family: 'Poppins', sans-serif;
}

.achievement-tab:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.achievement-tab.active {
    color: #facc15;
    border-bottom-color: #facc15;
}

.achievement-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.achievement-content::-webkit-scrollbar {
    width: 8px;
}

.achievement-content::-webkit-scrollbar-track {
    background: #0f172a;
    border-radius: 4px;
}

.achievement-content::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

.achievement-content::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

.achievement-tab-content {
    display: flex;
    flex-direction: column;
}

.achievements-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.achievement-card {
    background: rgba(30, 41, 59, 0.8);
    border: 2px solid #334155;
    border-radius: 12px;
    padding: 15px;
    transition: 0.3s;
}

.achievement-card:hover {
    border-color: #475569;
}

.achievement-card.achievement-claimable {
    border-color: #facc15;
    background: rgba(250, 204, 21, 0.1);
    box-shadow: 0 0 15px rgba(250, 204, 21, 0.3);
    animation: pulse 2s infinite;
}

.achievement-card.achievement-claimed {
    opacity: 0.6;
    border-color: #22c55e;
}

.achievement-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.achievement-icon {
    font-size: 32px;
    min-width: 40px;
    text-align: center;
}

.achievement-info {
    flex: 1;
}

.achievement-info h4 {
    color: #facc15;
    font-size: 16px;
    margin: 0 0 5px 0;
}

.achievement-info p {
    color: #94a3b8;
    font-size: 13px;
    margin: 0;
    line-height: 1.4;
}

.achievement-progress {
    margin-bottom: 12px;
}

.achievement-progress-bar {
    background: #0f172a;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.achievement-progress-fill {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    height: 100%;
    transition: width 0.4s ease;
    border-radius: 4px;
}

.achievement-card.achievement-claimable .achievement-progress-fill {
    background: linear-gradient(90deg, #facc15, #fbbf24);
}

.achievement-card.achievement-claimed .achievement-progress-fill {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

.achievement-progress-text {
    color: #cbd5e1;
    font-size: 11px;
    font-weight: bold;
}

.achievement-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.achievement-reward {
    color: #facc15;
    font-size: 14px;
    font-weight: bold;
}

.achievement-claim-btn {
    background: #facc15;
    color: #000;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 13px;
    cursor: pointer;
    transition: 0.2s;
    border-bottom: 3px solid #ca8a04;
    font-family: 'Poppins', sans-serif;
}

.achievement-claim-btn:hover {
    background: #fbbf24;
    transform: translateY(-2px);
}

.achievement-claim-btn:active {
    transform: translateY(0);
    border-bottom-width: 1px;
}

/* ===== SISTEMA PVP LIVE ===== */

/* Bottone sfida nella lista online */
.challenge-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: 0.2s;
    margin-left: auto;
    font-weight: bold;
}

.challenge-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.me-badge {
    background: #facc15;
    color: #000;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: bold;
    margin-left: auto;
}

/* Notifica invito PvP */
.pvp-invite-notification {
    background: rgba(239, 68, 68, 0.95);
    backdrop-filter: blur(12px);
    border: 3px solid #dc2626;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 10px;
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.5);
    animation: slideIn 0.4s ease;
    pointer-events: all;
    min-width: 300px;
}

.pvp-invite-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.pvp-invite-title {
    color: #fef2f2;
    font-size: 18px;
    font-weight: bold;
}

.pvp-invite-timer {
    background: rgba(0, 0, 0, 0.5);
    color: #fef2f2;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    font-family: monospace;
}

.pvp-invite-text {
    color: #fef2f2;
    font-size: 15px;
    margin: 10px 0 15px 0;
}

.pvp-invite-buttons {
    display: flex;
    gap: 10px;
}

.pvp-invite-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
    font-family: 'Poppins', sans-serif;
}

.pvp-invite-btn.accept {
    background: #22c55e;
    color: white;
    border-bottom: 4px solid #16a34a;
}

.pvp-invite-btn.accept:hover {
    background: #16a34a;
    transform: translateY(-2px);
}

.pvp-invite-btn.decline {
    background: #475569;
    color: white;
    border-bottom: 4px solid #334155;
}

.pvp-invite-btn.decline:hover {
    background: #64748b;
    transform: translateY(-2px);
}

.pvp-invite-btn:active {
    transform: translateY(0);
    border-bottom-width: 2px;
}

/* Messaggi risultato PvP in chat globale */
.pvp-result-message {
    background: rgba(239, 68, 68, 0.2) !important;
    border: 2px solid #ef4444 !important;
    border-left: 4px solid #ef4444 !important;
    padding: 12px !important;
}

.pvp-result-content {
    text-align: center;
}

.pvp-result-time {
    color: #94a3b8;
    font-size: 10px;
}

.pvp-result-text {
    color: #fef2f2;
    font-size: 13px;
    margin: 5px 0;
    line-height: 1.5;
}

.pvp-winner {
    color: #facc15;
    font-size: 12px;
}
.shop-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 15px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #334155;
}

.shop-tab {
    flex: 1;
    padding: 10px 15px;
    background: #0f172a;
    color: #94a3b8;
    border: none;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.shop-tab:hover {
    background: #1e293b;
}

.shop-tab.active {
    background: linear-gradient(135deg, #facc15 0%, #f59e0b 100%);
    color: #000;
}

.shop-content {
    min-height: 200px;
}

/* CUSTOMIZE MODAL */
.customize-preview {
    background: #0f172a;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-bottom: 15px;
    border: 2px solid #334155;
}

.customize-preview canvas {
    image-rendering: pixelated;
}

.customize-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 15px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #334155;
}

.customize-tab {
    flex: 1;
    padding: 10px 15px;
    background: #0f172a;
    color: #94a3b8;
    border: none;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.customize-tab:hover {
    background: #1e293b;
}

.customize-tab.active {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    color: #fff;
}

.cosmetics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.cosmetic-item {
    background: #1e293b;
    border: 2px solid #334155;
    border-radius: 10px;
    padding: 8px 5px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 70px;
}
.cosmetic-item:hover {
    border-color: #8b5cf6;
    transform: scale(1.05);
}

.cosmetic-item.selected {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.2);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

.cosmetic-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.cosmetic-item .icon {
    font-size: 24px;
    display: block;
    margin-bottom: 5px;
}

.cosmetic-item .name {
    font-size: 10px;
    color: #cbd5e1;
    display: block;
}

.cosmetic-item .status {
    font-size: 9px;
    margin-top: 5px;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

.cosmetic-item .status.owned {
    background: #22c55e;
    color: #000;
}

.cosmetic-item .status.buy {
    background: #facc15;
    color: #000;
}

.skin-preview {
    width: 64px;
    height: 64px;
    margin: 0 auto 5px;
    overflow: hidden;
    image-rendering: pixelated;
    position: relative;
}

.skin-preview-img {
    width: 128px;              /* Lo spritesheet ha 2 frame affiancati (64x2) */
    height: 64px;
    object-fit: cover;
    object-position: left top; /* Mostra solo il primo frame a sinistra */
    image-rendering: pixelated;
    position: absolute;
    left: 0;
    top: 0;
}

.cosmetic-item .name {
    font-size: 9px;
    color: #cbd5e1;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.profile-info {
    background: #0f172a;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    text-align: center;
}

.profile-info .username {
    font-size: 24px;
    font-weight: bold;
    color: #facc15;
    margin-bottom: 5px;
}

.profile-info .level-badge {
    display: inline-block;
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    padding: 3px 12px;
    border-radius: 15px;
    font-size: 12px;
    color: white;
    margin-bottom: 10px;
}

.profile-info .cups {
    font-size: 20px;
    color: #fbbf24;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.profile-stat-box {
    background: #1e293b;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
}

.profile-stat-box .value {
    font-size: 20px;
    font-weight: bold;
    color: #22c55e;
}

.profile-stat-box .label {
    font-size: 10px;
    color: #94a3b8;
}

.profile-dragons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.profile-dragon-card {
    background: #1e293b;
    border: 2px solid #334155;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    min-width: 120px;
    flex: 1;
    max-width: 150px;
}

.profile-dragon-card.active {
    border-color: #facc15;
    box-shadow: 0 0 10px rgba(250, 204, 21, 0.3);
}

.profile-dragon-card.locked {
    opacity: 0.4;
}

.profile-dragon-card .dragon-preview {
    width: 64px;
    height: 64px;
    margin: 0 auto 5px;
    overflow: hidden;
    image-rendering: pixelated;
}

.profile-dragon-card .dragon-preview img {
    width: 128px;
    height: 64px;
    object-fit: cover;
    object-position: left top;
    image-rendering: pixelated;
}

.profile-dragon-card .dragon-name {
    font-weight: bold;
    color: #ffffff;
    font-size: 12px;
}

.profile-dragon-card .dragon-type {
    font-size: 10px;
    color: #94a3b8;
    margin-bottom: 5px;
}

.profile-dragon-card .dragon-stats {
    font-size: 10px;
    color: #cbd5e1;
}

.profile-dragon-card .dragon-cosmetics {
    font-size: 14px;
    margin-top: 5px;
}

.profile-actions {
    margin-top: 15px;
    text-align: center;
}