/* ==========================================================================
   Riftly - V.4.0 (Final & Cleaned)
   ========================================================================== */

/* 1. IMPORT E VARIABILI GLOBALI */
@import url('https://fonts.googleapis.com/css2?family=Exo+2:wght@400;700;800&family=Roboto:wght@400;500&display=swap');

:root {
    --color-background: #010A13;
    --color-surface: #0A1428;
    --color-primary-accent: #0D90A3;
    --color-secondary-accent: #C8AA6E;
    --color-border: #153A58;
    --color-text-primary: #F0F8FF;
    --color-text-secondary: #A0B3CE;
    --font-heading: 'Exo 2', sans-serif;
    --font-body: 'Roboto', sans-serif;
    --transition-fast: 0.2s ease-in-out;
}

/* 2. RESET E STILI DI BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-background);
    color: var(--color-text-primary);
    line-height: 1.6;
}

body.no-scroll {
    overflow: hidden;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

h1, h2, h3, h4, h5 {
    font-family: var(--font-heading);
    font-weight: 800;
    text-transform: uppercase;
    color: var(--color-text-primary);
    margin-bottom: 1rem;
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); line-height: 1.1; }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.5rem); }
h3 { font-size: 1.3rem; color: var(--color-secondary-accent); }
h4 { font-size: 1.1rem; color: var(--color-primary-accent); }
h5 { font-size: 1rem; text-transform: none; font-weight: 700; }
p { color: var(--color-text-secondary); margin-bottom: 1rem; }
ul, ol { padding-left: 20px; }
li { margin-bottom: 0.5rem; }

/* 3. HEADER E NAVIGAZIONE */
.main-header {
    background: rgba(1, 10, 19, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--color-border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}
.main-header .container { display: flex; justify-content: space-between; align-items: center; }
.logo { display: flex; align-items: center; text-decoration: none; z-index: 1002; }
.logo span { font-family: var(--font-heading); font-size: 1.8rem; font-weight: 800; color: var(--color-primary-accent); }
.main-nav ul { list-style: none; display: flex; gap: 1.5rem; margin: 0; }
.main-nav a {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--color-text-primary);
    text-decoration: none;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid transparent;
    transition: var(--transition-fast);
}
.main-nav a:hover, .main-nav a.active { color: var(--color-secondary-accent); border-bottom-color: var(--color-secondary-accent); }
.nav-toggle { display: none; }

/* 4. SEZIONI PRINCIPALI (HERO, CARD, ECC.) */
.hero-section {
    position: relative;
    height: 70vh;
    display: flex;
    align-items: center;
    overflow: hidden;
    background-color: var(--color-background);
}
.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: url('../images/hero-background.jpg') no-repeat center center/cover;
}
.hero-background video { width: 100%; height: 100%; object-fit: cover; object-position: center 70%; }
.hero-content-container { position: relative; z-index: 2; }
.hero-content {
    background: linear-gradient(to right, rgba(1, 10, 19, 0.9) 0%, rgba(1, 10, 19, 0.5) 70%, rgba(1, 10, 19, 0) 100%);
    padding: 2rem;
}
.hero-content h1 { color: #fff; text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5); }
.hero-content p { font-size: 1.1rem; max-width: 500px; }

.btn {
    display: inline-block;
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    padding: 0.8rem 2rem;
    border: 2px solid var(--color-primary-accent);
    color: var(--color-text-primary);
    background-color: transparent;
    position: relative;
    transition: var(--transition-fast);
    clip-path: polygon(10% 0%, 100% 0%, 90% 100%, 0% 100%);
}
.btn:hover {
    background-color: var(--color-primary-accent);
    color: var(--color-background);
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--color-primary-accent);
}
.btn.btn-primary {
    background-color: var(--color-secondary-accent);
    border-color: var(--color-secondary-accent);
    color: var(--color-background);
    clip-path: polygon(0% 0%, 90% 0%, 100% 100%, 10% 100%);
}
.btn.btn-primary:hover { box-shadow: 0 0 20px var(--color-secondary-accent); }

.featured-guides { padding: 5rem 0; background-color: var(--color-background); }
.featured-guides h2, .page-intro h1 {
    text-align: center;
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}
.featured-guides h2::after, .page-intro h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: var(--color-secondary-accent);
    clip-path: polygon(10% 0, 100% 0, 90% 100%, 0% 100%);
}
.guides-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 4rem;
}
.guide-card {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    padding: 2rem;
    text-align: center;
    position: relative;
    transition: var(--transition-fast);
    clip-path: polygon(50% 0%, 100% 15%, 100% 85%, 50% 100%, 0% 85%, 0% 15%);
}
.guide-card:hover {
    transform: translateY(-10px);
    border-color: var(--color-primary-accent);
    box-shadow: 0 0 25px rgba(13, 144, 163, 0.5);
}
.card-icon { height: 80px; margin-bottom: 1.5rem; }

/* 5. PAGINE INTERNE E LAYOUT */
.page-intro { text-align: center; padding: 4rem 0; }
.page-intro p { max-width: 700px; margin: 1rem auto 0 auto; font-size: 1.1rem; }
.guide-hero-section {
    position: relative;
    padding: 4rem 0;
    min-height: 25vh;
    display: flex;
    align-items: center;
    text-align: center;
    overflow: hidden;
}
.guide-hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    filter: brightness(0.6);
    z-index: 1;
}
.guide-hero-content { position: relative; z-index: 2; }
.guide-hero-content h1, .guide-hero-content p { color: #fff; text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7); }
.guide-image {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    border: 2px solid var(--color-border);
    margin: 1.5rem auto;
}
.diagram-content { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.5rem; margin-bottom: 1.5rem; }
.diagram-image {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0;
    padding: 2rem;
    background-color: var(--color-surface);
    border-radius: 5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--color-border);
}
.map-image{
    width: 100%;
    display: block;
    max-width: 330px;
    margin: 1.5rem auto;
}
.guide-block {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    margin-bottom: 2rem;
    padding: 1.5rem;
}
.guide-block h2 { border-bottom: 2px solid var(--color-primary-accent); padding-bottom: 1rem; }
.role-card {
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    background: var(--color-background);
}
.role-card h3 { color: var(--color-primary-accent); margin-bottom: 0.5rem; }
.creators-container { display: grid; grid-template-columns: 1fr; gap: 2rem; margin-top: 2rem; }
.creator-card {
    background-color: var(--color-surface);
    border-left: 4px solid var(--color-primary-accent);
    padding: 2rem;
    border-radius: 0 5px 5px 0;
}
.creator-card h3 { color: var(--color-secondary-accent); }
.creator-card h4 { color: var(--color-text-secondary); text-transform: none; font-style: italic; margin-bottom: 1.5rem; }

/* 6. COMPONENTI (ACCORDION, GLOSSARIO, ECC.) */
.accordion-item { border: 1px solid var(--color-border); margin-bottom: 1rem; }
.accordion-item summary {
    font-size: 1.4rem; font-weight: 700; font-family: var(--font-heading); padding: 1rem 1.5rem;
    background-color: var(--color-surface); color: var(--color-text-primary); cursor: pointer;
    position: relative; outline: none; transition: var(--transition-fast);
}
.accordion-item summary:hover { background-color: #153A58; }
.accordion-item summary::after {
    content: '+'; font-size: 2rem; position: absolute; right: 1.5rem; top: 50%;
    transform: translateY(-50%); transition: transform var(--transition-fast);
}
.accordion-item[open] summary::after { content: '-'; transform: translateY(-50%) rotate(360deg); }
.accordion-content { padding: 1.5rem; background-color: var(--color-background); border-top: 1px solid var(--color-border); }
.accordion-content h4 { margin-top: 1rem; }
.accordion-content h5 { margin-top: 1.5rem; margin-bottom: 0.5rem; }

.glossary-container { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.glossary-term { background-color: var(--color-surface); border: 1px solid var(--color-border); padding: 1.5rem; border-radius: 5px; }
.glossary-term h3 { color: var(--color-primary-accent); margin-bottom: 0.5rem; }

/* 7. STRUMENTI */
.tool-section { display: flex; flex-direction: column; gap: 2rem; }
.team-selection { background: var(--color-surface); padding: 2rem; border: 1px solid var(--color-border); border-radius: 5px; text-align: center; }
.champion-slots { display: flex; justify-content: center; gap: 1rem; margin: 1.5rem 0; }
.champion-slot {
    width: 80px; height: 80px; background: var(--color-background); border: 2px dashed var(--color-border);
    border-radius: 50%; display: flex; justify-content: center; align-items: center;
    cursor: pointer; transition: var(--transition-fast);
}
.champion-slot:hover { border-color: var(--color-primary-accent); transform: scale(1.1); }
.plus-icon { font-size: 3rem; color: var(--color-border); font-weight: bold; }
#analyze-button:disabled { background-color: #555; border-color: #555; cursor: not-allowed; clip-path: none; border-radius: 5px; }
.results-section { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.result-card { background: var(--color-surface); padding: 1.5rem; border: 1px solid var(--color-border); border-radius: 5px; }
.pie-chart-container { display: flex; align-items: center; justify-content: center; gap: 2rem; margin-top: 1.5rem; flex-wrap: wrap; }
.pie-chart { width: 120px; height: 120px; border-radius: 50%; background: conic-gradient(#c84c2c 0deg, #3c7ac8 0deg); flex-shrink: 0; }
.chart-legend ul { list-style: none; padding: 0; }
.chart-legend li { display: flex; align-items: center; margin-bottom: 0.5rem; font-size: 1.1rem; }
.chart-legend li::before { content: ''; display: inline-block; width: 15px; height: 15px; border-radius: 50%; margin-right: 10px; }
.legend-ad::before { background-color: #c84c2c; }
.legend-ap::before { background-color: #3c7ac8; }
#threats-ul li, #items-ul li { margin-bottom: 0.8rem; list-style-type: '✓ '; padding-left: 10px; }
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(1, 10, 19, 0.85);
    backdrop-filter: blur(10px); display: none; justify-content: center; align-items: center; z-index: 2000;
}
.modal-content {
    background: var(--color-surface); padding: 2rem; border: 2px solid var(--color-border); border-radius: 10px;
    width: 90%; max-width: 800px; max-height: 80vh; overflow-y: auto; position: relative;
}
.close-button {
    position: absolute; top: 1rem; right: 1rem; background: none; border: none;
    color: var(--color-text-primary); font-size: 2rem; cursor: pointer;
}
#search-champion {
    width: 100%; padding: 0.8rem; margin: 1rem 0; background: var(--color-background);
    border: 1px solid var(--color-border); border-radius: 5px; color: var(--color-text-primary); font-size: 1rem;
}
.modal-champion-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 1rem; }
.modal-champion-item {
    background: var(--color-background); border: 1px solid var(--color-border); border-radius: 5px;
    padding: 0.5rem; text-align: center; cursor: pointer; transition: var(--transition-fast);
}
.modal-champion-item:hover { background: var(--color-primary-accent); border-color: var(--color-secondary-accent); }
.modal-champion-item span { font-size: 0.9rem; }
.role-filters {
    display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center;
    margin-bottom: 1rem; border-bottom: 1px solid var(--color-border); padding-bottom: 1rem;
}
.role-filter-btn {
    background: var(--color-background); border: 1px solid var(--color-border); color: var(--color-text-secondary);
    padding: 0.5rem 1rem; border-radius: 20px; font-family: var(--font-body); font-weight: bold;
    cursor: pointer; transition: var(--transition-fast);
}
.role-filter-btn:hover { background: var(--color-primary-accent); color: var(--color-text-primary); border-color: var(--color-primary-accent); }
.role-filter-btn.active-filter { background: var(--color-secondary-accent); color: var(--color-background); border-color: var(--color-secondary-accent); }
.timer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
.timer-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 5px; padding: 1.5rem; text-align: center; }
.timer-display { font-family: var(--font-heading); font-size: 3.5rem; font-weight: 800; color: var(--color-text-primary); margin: 1rem 0; letter-spacing: 2px; }
.timer-display.active { color: var(--color-secondary-accent); }
.timer-display.ending { color: #c84c2c; animation: pulse 1s infinite; }
.timer-buttons { display: flex; justify-content: center; gap: 1rem; }
.timer-btn {
    font-family: var(--font-heading); font-weight: 700; text-transform: uppercase; padding: 0.8rem 1.5rem;
    border-radius: 5px; border: 2px solid transparent; cursor: pointer; transition: var(--transition-fast);
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
}
.start-btn { background-color: var(--color-primary-accent); color: var(--color-text-primary); box-shadow: 0 0 10px rgba(13, 144, 163, 0.5); }
.start-btn:hover { background-color: #16c2d9; transform: scale(1.05); box-shadow: 0 0 20px rgba(13, 144, 163, 0.7); }
.reset-btn { background-color: transparent; border-color: var(--color-border); color: var(--color-text-secondary); }
.reset-btn:hover { background-color: var(--color-border); color: var(--color-text-primary); }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }
.quiz-selection-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.quiz-card { background: var(--color-surface); border: 2px solid var(--color-border); padding: 2rem; text-align: center; transition: var(--transition-fast); border-radius: 10px; }
.quiz-card:hover { transform: translateY(-5px); border-color: var(--color-primary-accent); }
.quiz-container, .results-container {
    background: var(--color-surface); border: 1px solid var(--color-border); padding: 2rem;
    border-radius: 5px; max-width: 800px; margin: 0 auto;
}
.quiz-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--color-border); padding-bottom: 1rem; margin-bottom: 1.5rem; }
#quiz-counter { font-weight: bold; color: var(--color-text-secondary); }
.question-text { font-size: 1.4rem; margin-bottom: 2rem; }
.answer-options { display: flex; flex-direction: column; gap: 1rem; }
.answer-btn {
    width: 100%; padding: 1rem; font-size: 1.1rem; font-family: var(--font-heading);
    font-weight: 700; text-transform: uppercase; background-color: var(--color-surface);
    color: var(--color-text-primary); border: 2px solid var(--color-border); border-radius: 5px;
    text-align: center; cursor: pointer; transition: var(--transition-fast);
}
.answer-btn:hover:not([disabled]) { background-color: var(--color-primary-accent); border-color: var(--color-primary-accent); transform: scale(1.02); }
.answer-btn.correct, .answer-btn.correct:hover { background-color: #2f855a; border-color: #38a169; color: #fff; transform: scale(1.02); }
.answer-btn.incorrect, .answer-btn.incorrect:hover { background-color: #9B2C2C; border-color: #c53030; color: #fff; opacity: 0.8; }
.answer-btn:disabled { cursor: not-allowed; opacity: 0.7; }
.answer-btn:disabled.correct { opacity: 1; }
.feedback-section { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--color-border); text-align: center; }
#feedback-text { font-style: italic; color: var(--color-text-secondary); }
.results-container { text-align: center; }
#score-text { font-size: 2rem; font-weight: bold; font-family: var(--font-heading); color: var(--color-secondary-accent); margin: 1.5rem 0; }
.creators-container { display: grid; grid-template-columns: 1fr; gap: 2rem; margin-top: 2rem; }
.creator-card { background-color: var(--color-surface); border-left: 4px solid var(--color-primary-accent); padding: 2rem; border-radius: 0 5px 5px 0; }
.creator-card h3 { color: var(--color-secondary-accent); }
.creator-card h4 { color: var(--color-text-secondary); text-transform: none; font-style: italic; margin-bottom: 1.5rem; }

/* ==========================================================================
   MEDIA QUERIES GLOBALI
   ========================================================================== */

/* Stili per tablet e schermi medi */
@media (min-width: 768px) {
    .guide-block { padding: 2.5rem; }
    .glossary-container { grid-template-columns: repeat(2, 1fr); }
    .results-section { grid-template-columns: repeat(3, 1fr); }
    .creators-container { grid-template-columns: repeat(2, 1fr); }
    .diagram-image { max-width: calc(33.333% - 1rem); }
}

/* Stili per desktop */
@media (min-width: 993px) {
    .guides-container {
        grid-template-columns: repeat(2, 1fr);
        max-width: 900px;
        margin-left: auto;
        margin-right: auto;
    }
    .main-nav { display: block; }
    .nav-toggle { display: none; }
    .dropdown { position: relative; }
    .dropdown-menu {
        opacity: 0; visibility: hidden; position: absolute; top: 100%; left: 0;
        background-color: var(--color-surface); border: 1px solid var(--color-border);
        border-radius: 0 0 5px 5px; list-style: none; padding: 1rem 0; min-width: 220px;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4); z-index: 1000;
        transform: translateY(10px); transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    }
    .dropdown:hover .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); display: block; }
    .dropdown-menu ul { display: flex; flex-direction: column; gap: 0; padding: 0; }
    .dropdown-menu li a { display: block; padding: 0.8rem 1.5rem; color: var(--color-text-secondary); font-size: 0.9rem; border-bottom: none; }
    .dropdown-menu li a:hover { background-color: var(--color-primary-accent); color: var(--color-text-primary); }
    .hero-background video { display: block; }
}

/* Stili per mobile */
@media (max-width: 992px) {
    h1 { font-size: 2.2rem; }
    h2 { font-size: 1.6rem; }
    .main-nav {
        position: fixed; top: 0; right: 0; width: 100%; height: 100vh;
        background: rgba(1, 10, 19, 0.95); backdrop-filter: blur(15px);
        transform: translateX(100%); transition: transform 0.3s ease-in-out;
        z-index: 1001; padding-top: 8rem;
    }
    .main-nav.nav-active { transform: translateX(0); }
    .main-nav > ul { flex-direction: column; align-items: center; gap: 2rem; }
    .main-nav a { font-size: 1.5rem; border: none; }
    .dropdown { display: flex; flex-direction: column; align-items: center; gap: 1.5rem; }
    .dropdown-menu { display: none; flex-direction: column; align-items: center; list-style: none; padding: 0; gap: 1.5rem; margin-top: 1.5rem; }
    .dropdown.submenu-active .dropdown-menu { display: flex; }
    .dropdown-menu li a { font-size: 1.2rem; color: var(--color-text-secondary); font-weight: 600; }
    .nav-toggle { display: block; background: transparent; border: none; cursor: pointer; padding: 0.5rem; z-index: 1002; }
    .hamburger {
        display: block; position: relative; width: 25px; height: 3px;
        background: var(--color-text-primary); border-radius: 3px; transition: all 0.3s ease-in-out;
    }
    .hamburger::before, .hamburger::after {
        content: ''; position: absolute; width: 25px; height: 3px;
        background: var(--color-text-primary); border-radius: 3px; transition: all 0.3s ease-in-out;
    }
    .hamburger::before { top: -8px; }
    .hamburger::after { bottom: -8px; }
    .nav-toggle.nav-active .hamburger { background: transparent; }
    .nav-toggle.nav-active .hamburger::before { transform: rotate(45deg) translate(6px, 6px); }
    .nav-toggle.nav-active .hamburger::after { transform: rotate(-45deg) translate(5px, -5px); }
    .hero-content {
        max-width: 100%;
        background: linear-gradient(to right, rgba(1, 10, 19, 0.8) 0%, rgba(1, 10, 19, 0.6) 100%);
        text-align: center;
        padding: 1.5rem;
    }
    .guide-card { clip-path: none; border-radius: 10px; }
    .guides-container { grid-template-columns: 1fr; }
    .champion-slots { flex-wrap: wrap; gap: 0.8rem; padding: 0 1rem; }
    .hero-background video { display: none; }
}

@media (max-width: 767px) {
    .diagram-content { flex-direction: column; }
}