/* Reset e font */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: 'Cinzel', serif;
    background-color: #0a0a0a;
    color: #e6d7a8;
    line-height: 1.6;
    position: relative;
    z-index: 0;
    padding-top: 80px; /* Spazio per l'header fisso */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* Video di sfondo */
.background-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    z-index: -1;
    opacity: 0.3;
    pointer-events: none;
}

/* Header */
header {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 0;
    z-index: 1000;
}

.header-container {
    max-width: 90%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
}

.logo-link {
    display: block;
}

.logo {
    width: 100%;
    max-width: 180px;
    height: auto;
}

.nav-menu {
    display: flex;
    align-items: center;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 15px;
}

.nav-links li a,
.nav-links li span {
    color: #e6d7a8;
    text-decoration: none;
    font-size: 0.9rem;
    text-transform: uppercase;
    transition: color 0.3s;
}

.nav-links li a:hover,
.nav-links li a.active {
    color: #d4a017;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    color: #e6d7a8;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Statistics Bar */
.stats-bar {
    background: #f4e8d1;
    border: 2px solid #b8860b;
    border-radius: 8px;
    padding: 10px 20px;
    max-width: 800px;
    margin: 80px auto 0; /* Ridotto da 110px a 80px per avvicinare all'header */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    font-family: 'MedievalSharp', cursive;
    color: #2c1e0f;
}

.stats-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1em;
}

.stat-item i {
    color: #b8860b;
    font-size: 1.2em;
}

.stat-item span {
    font-size: 0.9em;
}

/* Top Ranking Section - Panel Design */
.top-ranking-section {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.ranking-panels-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.ranking-panel {
    background: rgba(26, 26, 26, 0.9);
    border: 2px solid #b8860b;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 0 20px rgba(184, 134, 11, 0.3);
    min-height: 400px;
}

.ranking-panel-title {
    font-family: 'Cinzel', serif;
    color: #fff;
    font-size: 1.5em;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    letter-spacing: 2px;
    padding-bottom: 10px;
    border-bottom: 2px solid #8B0000;
}

.ranking-panel-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* First Place Featured Card */
.ranking-first-place {
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.2) 0%, rgba(26, 26, 26, 0.8) 100%);
    border: 3px solid #8B0000;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 0 15px rgba(139, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.ranking-first-place::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.1) 0%, transparent 100%);
    pointer-events: none;
}

.first-place-avatar {
    position: relative;
    flex-shrink: 0;
}

.avatar-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d1b0e 100%);
    border: 3px solid #b8860b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5em;
    box-shadow: 0 0 15px rgba(184, 134, 11, 0.5);
}

.first-place-medal {
    position: absolute;
    top: -5px;
    left: -5px;
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border-radius: 50%;
    border: 3px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 1.2em;
    color: #1a1a1a;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    z-index: 2;
}

.first-place-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.first-place-name {
    font-family: 'Cinzel', serif;
    color: #fff;
    font-size: 1.4em;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.first-place-empire {
    color: #8B0000;
    font-size: 0.8em;
    font-weight: 600;
}

.first-place-level {
    color: #e6d7a8;
    font-size: 1.1em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Ranking List Items (2-3) */
.ranking-list-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ranking-list-item {
    background: rgba(26, 26, 26, 0.6);
    border: 1px solid rgba(184, 134, 11, 0.3);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
}

.ranking-list-item:hover {
    background: rgba(45, 27, 14, 0.6);
    border-color: #b8860b;
    transform: translateX(5px);
}

.list-medal {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 1em;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
}

.list-icon {
    font-size: 1.8em;
    filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.8));
    flex-shrink: 0;
}

.list-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.list-name {
    font-family: 'Cinzel', serif;
    color: #fff;
    font-size: 1.1em;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.list-level {
    color: #c9a961;
    font-size: 0.9em;
}

/* Top 100 Button */
.ranking-top-button {
    background: linear-gradient(135deg, #8B0000 0%, #A52A2A 100%);
    border: 2px solid #b8860b;
    border-radius: 8px;
    padding: 12px 20px;
    text-align: center;
    color: #fff;
    font-family: 'Cinzel', serif;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    margin-top: 10px;
    box-shadow: 0 2px 8px rgba(139, 0, 0, 0.4);
}

.ranking-top-button:hover {
    background: linear-gradient(135deg, #A52A2A 0%, #8B0000 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.6);
    border-color: #d4af37;
}

.ranking-top-button i {
    transition: transform 0.3s ease;
}

.ranking-top-button:hover i {
    transform: translateX(5px);
}

.ranking-empty {
    text-align: center;
    padding: 40px 20px;
    color: #c9a961;
    font-style: italic;
}


/* Hero Section */
.hero {
    position: relative;
    height: 80vh;
    min-height: 500px;
    max-height: 800px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-top: 20px;
    padding: 20px;
}

.hero-overlay {
    background: rgba(0, 0, 0, 0.5);
    padding: 20px;
    border-radius: 10px;
}

.hero-overlay h1 {
    font-family: 'Cinzel', serif;
    color: #b8860b;
    font-size: 3em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.hero-overlay .tagline {
    font-family: 'MedievalSharp', cursive;
    color: #f4e8d1;
    font-size: 1.5em;
    margin: 10px 0;
}

.hero-overlay .release-date {
    font-family: 'MedievalSharp', cursive;
    color: #d2b48c;
    font-size: 1.2em;
    margin-bottom: 20px;
}

.hero-overlay .discord-button,
.hero-overlay .action-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 25px;
    margin: 10px;
    border: 2px solid #b8860b;
    border-radius: 5px;
    font-family: 'Cinzel', serif;
    text-decoration: none;
    transition: background 0.3s, transform 0.2s;
}

.hero-overlay .discord-button {
    background: #7289da;
    color: #fff;
}

.hero-overlay .action-button {
    background: #b8860b;
    color: #2c1e0f;
}

.hero-overlay .discord-button:hover,
.hero-overlay .action-button:hover {
    background: #d2b48c;
    transform: scale(1.05);
}

.hero-overlay .action-button i,
.hero-overlay .discord-button i {
    font-size: 1.2rem;
}

/* News Section */
.news-section {
    max-width: 800px;
    margin: 50px auto;
    padding: 20px;
    background: #f4e8d1;
    border: 3px solid #b8860b;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    font-family: 'MedievalSharp', cursive;
    color: #2c1e0f;
}

.news-section h2 {
    font-family: 'Cinzel', serif;
    color: #b8860b;
    font-size: 2em;
    text-align: center;
    margin-bottom: 20px;
}

.news-item {
    background: #e6d8b8;
    padding: 15px;
    margin: 15px 0;
    border: 1px solid #b8860b;
    border-radius: 5px;
}

.news-item.news {
    border-left: 5px solid #2f4f4f;
}

.news-item.changelog {
    border-left: 5px solid #b8860b;
}

.news-item h3 {
    font-family: 'Cinzel', serif;
    color: #2c1e0f;
    font-size: 1.5em;
    margin-bottom: 10px;
}

.news-meta {
    font-size: 0.9em;
    color: #2f4f4f;
    margin-bottom: 10px;
}

.news-content {
    font-size: 1.1em;
    line-height: 1.6;
}

.news-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.news-actions .action-button {
    padding: 8px 15px;
    font-size: 1em;
}

.news-actions .action-button.liked {
    background: #ffd700;
}

.comment-form {
    margin-top: 10px;
}

.comment-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #b8860b;
    border-radius: 5px;
    font-family: 'MedievalSharp', cursive;
    resize: vertical;
}

.comments {
    margin-top: 10px;
}

.comment {
    background: #f4e8d1;
    padding: 10px;
    margin: 5px 0;
    border: 1px solid #b8860b;
    border-radius: 5px;
}

.comment p {
    margin: 5px 0;
}

/* Register Section */
.register,
.login,
.ranking {
    padding: 90px 15px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.2));
    text-align: center;
    position: relative;
    overflow: hidden;
}

.register-container,
.login-container,
.ranking-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.register h1,
.login h1,
.ranking h1 {
    font-size: 2.5rem;
    font-family: 'MedievalSharp', cursive;
    color: #d4a017;
    margin-bottom: 30px;
    text-shadow: 0 0 10px rgba(212, 160, 23, 0.5);
    animation: glow 2s infinite alternate;
}

.form-content,
.ranking-content {
    background: linear-gradient(to bottom, #f4e8c1, #d4c0a1);
    padding: 30px;
    border: 3px solid #d4a017;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(212, 160, 23, 0.5);
    text-align: left;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 1rem;
    color: #333;
    margin-bottom: 5px;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 2px solid #d4a017;
    border-radius: 5px;
    background: #f4e8c1;
    color: #333;
    font-size: 1rem;
}

.g-recaptcha {
    margin: 15px 0;
}

.register-form button,
.login-form button {
    width: 100%;
    padding: 10px;
    background: #d4a017;
    color: #0a0a0a;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    text-transform: uppercase;
    transition: background 0.3s;
}

.register-form button:hover,
.login-form button:hover {
    background: #b89b4e;
}

.success {
    color: #2e7d32;
    margin-bottom: 15px;
    text-align: center;
}

.errors {
    list-style: none;
    color: #d32f2f;
    margin-bottom: 15px;
    text-align: center;
}

.errors li {
    margin-bottom: 5px;
}

.form-content a {
    color: #d4a017;
    text-decoration: none;
}

.form-content a:hover {
    text-decoration: underline;
}

/* Ranking Section */
.ranking-table {
    width: 100%;
    border-collapse: collapse;
    color: #333;
}

.ranking-table th,
.ranking-table td {
    padding: 10px;
    border: 1px solid #d4a017;
    text-align: center;
}

.ranking-table th {
    background: #d4a017;
    color: #0a0a0a;
    font-family: 'MedievalSharp', cursive;
}

.ranking-table tr:nth-child(even) {
    background: #e6d7a8;
}

.ranking-table tr:hover {
    background: #f4e8c1;
}

/* Footer */
footer {
    background: rgba(0, 0, 0, 0.6);
    padding: 20px 15px;
    color: #b89b4e;
}

.footer-container {
    max-width: 90%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}

.footer-column h3 {
    font-size: 1.2rem;
    color: #d4a017;
    margin-bottom: 10px;
}

.footer-column p,
.footer-column ul {
    font-size: 0.8rem;
}

.footer-column ul {
    list-style: none;
}

.footer-column ul li {
    margin-bottom: 8px;
}

.footer-column ul li a {
    color: #e6d7a8;
    text-decoration: none;
}

.footer-column ul li a:hover {
    color: #d4a017;
}

.footer-copy {
    text-align: center;
    margin-top: 10px;
    font-size: 0.7rem;
}

/* Animazioni */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateY(50px);
    }
}

@keyframes glow {
    from {
        text-shadow: 0 0 10px rgba(212, 160, 23, 0.5);
    }
    to {
        text-shadow: 0 0 20px rgba(212, 160, 23, 0.8);
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .hero-overlay h1 {
        font-size: 2.5rem;
    }

    .tagline {
        font-size: 1rem;
    }

    .release-date {
        font-size: 0.9rem;
    }

    .register h1,
    .login h1,
    .ranking h1 {
        font-size: 1.8rem;
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 60px;
    }

    .hero {
        height: 70vh;
        margin-top: 10px; /* Ridotto da 100px a 10px per mobile */
    }

    .stats-bar {
        padding: 10px;
        margin: 70px auto 0; /* Ridotto da 10px a 70px per mobile */
    }

    .stats-container {
        flex-direction: column;
        gap: 10px;
    }

    .stat-item {
        font-size: 0.9em;
    }

    .stat-item span {
        font-size: 0.8em;
    }

    .news-section {
        margin: 20px auto;
        padding: 15px;
    }

    .hero-overlay h1 {
        font-size: 2em;
    }

    .hero-overlay .tagline {
        font-size: 1.2em;
    }

    .hero-overlay .release-date {
        font-size: 1em;
    }

    .hero-overlay .discord-button,
    .hero-overlay .action-button {
        padding: 10px 20px;
        font-size: 0.9em;
    }

    .register,
    .login,
    .ranking {
        padding: 20px 10px;
    }

    .register h1,
    .login h1,
    .ranking h1 {
        font-size: 1.6rem;
    }

    .logo {
        max-width: 140px;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: rgba(0, 0, 0, 0.8);
        padding: 10px;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links li a,
    .nav-links li span {
        font-size: 0.8rem;
    }

    .hamburger {
        display: block;
    }

    .header-container,
    .footer-container {
        max-width: 100%;
    }

    .register-container,
    .login-container,
    .ranking-container {
        max-width: 90%;
        padding: 20px;
    }

    .ranking-table th,
    .ranking-table td {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .hero-overlay h1 {
        font-size: 1.8rem;
    }

    .tagline {
        font-size: 0.8rem;
    }

    .release-date {
        font-size: 0.7rem;
    }

    .register h1,
    .login h1,
    .ranking h1 {
        font-size: 1.4rem;
    }

    .form-group input,
    .ranking-table th,
    .ranking-table td {
        font-size: 0.8rem;
    }

    .ranking-table {
        font-size: 0.7rem;
    }
}

/* Stile per le icone nel menu di navigazione */
.nav-links a {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Cinzel', serif;
    color: #fff;
    text-decoration: none;
    padding: 10px 15px;
    transition: color 0.3s ease, transform 0.2s ease;
}

.nav-links a i {
    font-size: 1.2rem;
    color: #d4af37;
}

.nav-links a:hover i {
    color: #ffd700;
    transform: scale(1.1);
}

.nav-links a.active i {
    color: #ffd700;
}

/* Per il menu responsive (hamburger) */
@media (max-width: 768px) {
    .nav-links a {
        justify-content: center;
    }
}

/* Download Section */
.download-section {
    text-align: center;
    padding: 50px 20px;
    background: rgba(0, 0, 0, 0.5);
    margin: 40px auto 20px;
    max-width: 800px;
    border: 3px solid #b8860b;
    border-radius: 10px;
}

.download-container h2 {
    font-family: 'Cinzel', serif;
    color: #b8860b;
    font-size: 2em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.download-container p {
    font-family: 'MedievalSharp', cursive;
    color: #f4e8d1;
    font-size: 1.2em;
    margin: 15px 0;
}

.download-container .action-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 25px;
    background: #b8860b;
    color: #2c1e0f;
    border: 2px solid #2f4f4f;
    border-radius: 5px;
    font-family: 'Cinzel', serif;
    text-decoration: none;
    transition: background 0.3s, transform 0.2s;
}

.download-container .action-button:hover {
    background: #d2b48c;
    transform: scale(1.05);
}

.download-container .action-button i {
    font-size: 1.2rem;
}

@media (max-width: 768px) {
    .download-section {
        padding: 30px 15px;
        margin-top: 30px;
    }
    .download-container h2 {
        font-size: 1.5em;
    }
    .download-container p {
        font-size: 1em;
    }
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    margin-top: 90px;
    background: rgba(0, 0, 0, 0.8);
    border-bottom: 1px solid #b8860b;
    z-index: 1002; /* Sopra l'header */
    display: none; /* Nascosto di default, mostrato via JS */
    justify-content: center;
    align-items: center;
    padding: 10px 20px;
    font-family: 'Cinzel', serif;
    color: #e6d7a8;
}

.cookie-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    width: 100%;
    gap: 20px;
}

.cookie-content p {
    font-size: 0.9em;
    margin: 0;
    flex: 1;
}

.cookie-content a {
    color: #d4a017;
    text-decoration: underline;
}

.cookie-content a:hover {
    color: #ffd700;
}

.cookie-button {
    background: #b8860b;
    color: #2c1e0f;
    border: 1px solid #2f4f4f;
    padding: 8px 15px;
    border-radius: 5px;
    font-family: 'Cinzel', serif;
    font-size: 0.9em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

.cookie-button:hover {
    background: #d2b48c;
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .cookie-banner {
        padding: 8px 15px;
    }

    .cookie-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .cookie-content p {
        font-size: 0.8em;
    }

    .cookie-button {
        padding: 6px 12px;
        font-size: 0.8em;
    }
    
    .top-ranking-section {
        margin: 20px auto;
        padding: 0 15px;
    }
    
    .ranking-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .ranking-slider {
        padding: 15px;
    }
    
    .ranking-title {
        font-size: 1.2em;
    }
    
    .ranking-card {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }
    
    .ranking-place {
        min-width: 60px;
        height: 60px;
    }
    
    .place-number {
        font-size: 1.5em;
    }
    
    .ranking-stats {
        justify-content: center;
    }
    
    .slider-btn {
        width: 35px;
        height: 35px;
        font-size: 1em;
    }
}

/* Responsive Top Ranking - Tablet */
/* Responsive Top Ranking - Panel */
@media (max-width: 968px) {
    .ranking-panels-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .ranking-panel {
        padding: 15px;
    }
    
    .ranking-panel-title {
        font-size: 1.3em;
    }
    
    .avatar-circle {
        width: 70px;
        height: 70px;
        font-size: 2em;
    }
    
    .first-place-medal {
        width: 30px;
        height: 30px;
        font-size: 1em;
    }
    
    .first-place-name {
        font-size: 1.2em;
    }
    
    .list-medal {
        width: 30px;
        height: 30px;
        font-size: 0.9em;
    }
    
    .list-name {
        font-size: 1em;
    }
}

/* Performance optimizations */
.ranking-item-compact {
    will-change: transform;
}