@font-face {
    font-family: 'PED';
    src: url('PED_____.TTF') format('truetype');
    font-weight: normal;
    font-style: normal;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Arial', sans-serif;
}

body {
    background: linear-gradient(135deg, #3a3a3a, #1a1a1a);
    color: #fff;
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 30px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.logo {
    height: 80px; /* Adjust as needed */
    width: auto;
    display: block;
    margin: 0 auto;
}
h1 {
    text-align: center;
    color: #fff;
    font-size: 3.5rem;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.7);
    font-weight: bold;
    font-family: 'Arial', sans-serif;
    letter-spacing: 2px;
    margin: 0;
    line-height: 1.2;
}

h1:first-of-type {
    margin-bottom: 5px;
    font-size: 2.5rem;
}

h1:last-of-type {
    margin-bottom: 20px;
    color: #ff0000;
}

.controls {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.controls label {
    font-weight: bold;
    margin-right: 5px;
    color: #fff;
}

.controls input {
    padding: 12px;
    border: none;
    border-radius: 6px;
    flex: 1;
    min-width: 150px;
    background-color: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 1rem;
}

.controls button {
    background-color: #a84c00;
    color: #333;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
    font-size: 1rem;
}

.controls button:hover {
    background-color: #ff0000;
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

.sort-options {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
}

/* Stile per il numero ordinale */
td:first-child::after {
    content: "°";
    font-weight: bold;
}

.sort-btn {
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    padding: 12px 20px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
    color: #fff;
    font-weight: bold;
    font-size: 1rem;
}

.sort-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.sort-btn.active {
    background-color: #ff0000;
    color: #333;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

.ranking-container {
    background-color: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    margin: 0 auto;
    width: 100%;
    padding: 0;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 15px;
}

thead {
    display: none;
}

td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 1.2rem;
}

tr:last-child td {
    border-bottom: none;
}

td:first-child {
    font-weight: bold;
    width: 15%;
    font-size: 1.5rem;
    text-align: center;
}

td:nth-child(2) {
    width: 50%;
    font-size: 1.5rem;
    padding-left: 10px;
}

td:nth-child(3) {
    width: 35%;
    text-align: right;
    font-weight: bold;
    font-size: 1.5rem;
    padding-right: 30px;
}

td:nth-child(4) {
    display: none;
}

tr {
    background-color: transparent;
    transition: all 0.3s;
}

tr:hover {
    background-color: rgba(255, 135, 0, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

tr.selected {
    background-color: rgba(255, 135, 0, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Stili per le prime tre posizioni */
tr.first-place td {
    background-color: rgba(255, 215, 0, 0.1);
    font-weight: bold;
    color: white;
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
}

tr.first-place td:first-child {
    color: #FFD700;
    font-size: 2em;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

tr.second-place td {
    background-color: rgba(192, 192, 192, 0.1);
    font-weight: bold;
    color: white;
    border-bottom: 1px solid rgba(192, 192, 192, 0.3);
}

tr.second-place td:first-child {
    color: #C0C0C0;
    font-size: 1.8em;
    text-shadow: 0 0 8px rgba(192, 192, 192, 0.5);
}

tr.third-place td {
    background-color: rgba(205, 127, 50, 0.1);
    font-weight: bold;
    color: white;
    border-bottom: 1px solid rgba(205, 127, 50, 0.3);
}

tr.third-place td:first-child {
    color: #CD7F32;
    font-size: 1.6em;
    text-shadow: 0 0 8px rgba(205, 127, 50, 0.5);
}

.loading, .error {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    border-radius: 10px;
}

.loading {
    color: #ff0000;
    background-color: rgba(0, 0, 0, 0.2);
}

.error {
    color: #ff0000;
    background-color: rgba(255, 107, 107, 0.1);
    border-radius: 10px;
    border-left: 4px solid #ff0000;
}

.api-note {
    width: 100%;
    font-size: 0.9em;
    color: #ddd;
    margin-top: 15px;
    padding: 10px;
    border-left: 3px solid #ff0000;
    background-color: rgba(255, 119, 0, 0.1);
    border-radius: 5px;
}

.hidden {
    display: none;
}

/* Stili per i dettagli del giocatore */
.player-details {
    background-color: rgba(0, 0, 0, 0.9);
    border-radius: 10px;
    padding: 20px;
    margin: 0;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.3s ease;
    max-height: 0;
    overflow: hidden;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    z-index: 1000;
    width: 90%;
    max-width: 600px;
}

.player-details.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    max-height: 500px;
    display: block;
}

/* Overlay scuro quando il popup è visibile */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.popup-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.details-header h2 {
    color: #ff0000;
    font-family: 'Arial', sans-serif;
    margin: 0;
    text-transform: uppercase;
}

.close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.player-name {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 20px;
    text-align: center;
}

.stats-container {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
}

.stat-box {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    min-width: 150px;
    text-align: center;
    flex: 1;
}

.stat-label {
    font-size: 14px;
    color: #ccc;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #ff0000;
}

/* Stili per le statistiche dei ruoli */
.role-stats-container, .game-scores-container {
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.role-stats-container h3, .game-scores-container h3 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 18px;
    color: #333;
}

/* Stili per i punteggi delle partite */
.game-scores-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.game-score {
    padding: 8px 12px;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.score-value {
    font-size: 18px;
    font-weight: bold;
}

.score-role {
    font-size: 12px;
    margin-top: 4px;
}

/* Colori per i diversi ruoli */
.law {
    background-color: #d4edda;
    color: #155724;
}

.outlaw {
    background-color: #f8d7da;
    color: #721c24;
}

.renegade {
    background-color: #fff3cd;
    color: #856404;
}

.dead-renegade {
    background-color: #d6d8d9;
    color: #1b1e21;
}

/* Responsive design */
@media (max-width: 768px) {
    .logo {
        height: 60px; /* Smaller size for mobile */
    }
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 2.5rem;
    }
    
    h1:first-of-type {
        font-size: 2rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .controls input {
        width: 100%;
    }
    
    td {
        padding: 12px 15px;
        font-size: 1rem;
    }
    
    td:first-child {
        font-size: 1.3rem;
    }
    
    td:nth-child(2) {
        font-size: 1.2rem;
    }
    
    td:nth-child(3) {
        font-size: 1.2rem;
        padding-right: 15px;
    }
    
    .sort-options {
        flex-direction: column;
        gap: 10px;
    }
    
    .sort-btn {
        width: 100%;
        padding: 10px;
    }
    
    tr.first-place td:first-child,
    tr.second-place td:first-child,
    tr.third-place td:first-child {
        font-size: 1.5em;
    }
}

/* Mobile optimization */
@media (max-width: 768px) {
  .player-details {
    max-height: 80vh !important;
    height: 80vh !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding: 15px;
  }
  
  .details-content {
    padding: 15px;
    min-height: min-content;
  }
  
  .close-btn {
    position: sticky;
    top: 10px;
    right: 10px;
    z-index: 1;
    background: rgba(0,0,0,0.7);
  }
}

@media (max-width: 768px) {
  .game-scores-container {
    max-height: 50vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .game-scores-list {
    flex-direction: column;
    min-height: min-content;
    padding: 10px;
  }

  .game-score {
    width: 100%;
    padding: 12px;
    font-size: 14px;
  }
}