/* Stili Generali */
:root {
    --primary-color: #0d1117; 
    --secondary-color: #161b22;
    --accent-color: #28a745;
    --hover-color: #2cbf4d;
    --text-color: #c9d1d9;
    --red-color: #e85656;
    --font-heading: 'Cinzel', serif;
    --font-body: 'Open Sans', sans-serif;
    --border-radius: 8px;
    --transition-speed: 0.3s;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-body); color: var(--text-color); background-color: var(--primary-color); background-image: url('images/Strasburgo1789_01.png'); background-size: cover; background-position: center center; background-attachment: fixed; line-height: 1.6; overflow-x: hidden; }
main { padding: 40px 20px; max-width: 1200px; margin: 0 auto; }
h1 { font-size: 2.8rem; line-height: 1.2; }
h2 { font-size: 2.5rem; text-align: center; margin-bottom: 3rem; position: relative; padding-bottom: 1rem; }
h2::after { content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 80px; height: 3px; background-color: var(--accent-color); border-radius: 2px; }
section { padding: 40px; margin-bottom: 60px; background-color: rgba(22, 27, 34, 0.95); border-radius: var(--border-radius); box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3); overflow: hidden; }

/* Header */
.main-header { background-color: rgba(13, 17, 23, 0.9); backdrop-filter: blur(5px); padding: 1rem 0; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4); position: sticky; top: 0; z-index: 1000; }
.navbar { display: flex; justify-content: space-between; align-items: center; max-width: 1200px; margin: 0 auto; padding: 0 20px; padding-left: 180px; }
.logo { font-family: var(--font-heading); font-size: 1.8rem; color: #f0f6fc; font-weight: 700; text-decoration: none; }
.nav-links { list-style: none; display: none;/*display: flex;*/ align-items: center; }
.nav-links li { margin-left: 30px; }
.nav-links a { color: var(--text-color); font-weight: 400; text-decoration: none; transition: color var(--transition-speed) ease; font-size: 1rem; white-space: nowrap; }
.nav-links a:hover { color: var(--accent-color); }
.navbar-right { display: flex; align-items: center; gap: 20px; }
.hamburger { /*display: none;*/display: flex; flex-direction: column; justify-content: space-around; width: 30px; height: 25px; background: transparent; border: none; cursor: pointer; padding: 0; z-index: 10; }
.hamburger:focus { outline: none; }
.hamburger-line { width: 30px; height: 3px; background-color: var(--text-color); border-radius: 10px; transition: all 0.3s linear; position: relative; transform-origin: 1px; }
.nav-open .hamburger-line:nth-child(1) { transform: rotate(45deg); }
.nav-open .hamburger-line:nth-child(2) { opacity: 0; transform: translateX(20px); }
.nav-open .hamburger-line:nth-child(3) { transform: rotate(-45deg); }
.language-selector { display: flex; gap: 10px; align-items: center; }
.lang-flag { width: 30px; height: 20px; cursor: pointer; border-radius: 3px; transition: all 0.2s ease; opacity: 0.6; border: 2px solid transparent; }
.lang-flag:hover { opacity: 1; transform: scale(1.1); }
.lang-flag.active { opacity: 1; border-color: var(--accent-color); box-shadow: 0 0 8px var(--accent-color); }

/* Sezione Hero e Dettagli */
.hero-layout .hero-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap; /* Assicura che i pulsanti vadano a capo su schermi stretti */
}
.hero-section { padding-bottom: 40px; border-bottom-left-radius: 0; border-bottom-right-radius: 0; margin-bottom: 0; }
.hero-layout { text-align: center; } 
.hero-layout h1 { margin-bottom: 1.5rem; }
.hero-layout .subtitle { margin: 1.5rem 0; line-height: 1.7; }
.hero-layout .book-cover { margin: 30px auto; max-width: 300px; }

.book-cover { box-shadow: 0 10px 30px rgba(0,0,0,0.5); position: relative; aspect-ratio: 9 / 16; background-size: cover; background-position: top center; border-radius: 5px; overflow: hidden; }
#hero-video { width: 100%; height: 100%; object-fit: cover; display: none; }
.book-details-section { padding: 30px 20px; border-top-left-radius: 0; border-top-right-radius: 0; border-top: 1px solid #30363d; }
.details-grid { display: flex; justify-content: space-around; flex-wrap: wrap; gap: 20px; }
.detail-item { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 150px; }
.detail-icon { font-size: 2rem; margin-bottom: 8px; color: var(--accent-color); }
.detail-label { font-size: 0.9rem; color: #8b949e; }
.detail-value { font-size: 1.1rem; font-weight: bold; color: #f0f6fc; }
.btn-primary, .btn-secondary {
    display: inline-block;
    padding: 12px 25px;
    border-radius: 50px;
    font-weight: 700;
    text-transform: uppercase;
    transition: all var(--transition-speed) ease;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--accent-color);
    color: var(--primary-color);
    border: 2px solid transparent; /* Bordo invisibile per allineamento */
}

.btn-primary:hover {
    background-color: var(--hover-color);
    transform: translateY(-3px);
}

.btn-secondary {
    background-color: transparent;
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
}

.btn-secondary:hover {
    background-color: var(--accent-color);
    color: var(--primary-color);
}
.scroller-container { position: relative; }
.scroller-list {
    display: flex; 
    overflow-x: auto; 
    gap: 20px; 
    padding-bottom: 10px; 
    scroll-behavior: smooth; 
    scrollbar-width: none; 
    -ms-overflow-style: none; 
    padding-left: 40px; 
    padding-right: 40px; 
    margin-left: -40px; 
    margin-right: -40px; 
}
.scroller-list::-webkit-scrollbar { display: none; }
.data-card { background-color: var(--primary-color); border-radius: var(--border-radius); overflow: hidden; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); text-align: center; transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease; display: flex; flex-direction: column; cursor: pointer; }
.data-card:hover { transform: translateY(-10px); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7); }
.scroller-list .data-card { width: 300px; flex-shrink: 0; }
.data-card img { width: 100%; object-fit: cover; }
#characters-section .data-card img, #factions-section .data-card img { height: 380px; }
#short-stories .data-card img { height: 180px; }
.data-card .card-content { padding: 1.5rem; flex-grow: 1; display: flex; flex-direction: column; justify-content: space-between; text-align: left; }
.data-card h3 { margin-bottom: 0.5rem; text-align: center; }
.data-card p { font-size: 0.95rem; margin-bottom: 1.5rem; }
.scroll-btn { position: absolute; top: calc(50% - 20px); transform: translateY(-50%); z-index: 10; background-color: rgba(13, 17, 23, 0.9); color: var(--text-color); border: 1px solid #444; border-radius: 50%; width: 50px; height: 50px; font-size: 1.5rem; cursor: pointer; transition: all var(--transition-speed) ease; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
.scroll-btn:hover { background-color: var(--accent-color); color: var(--primary-color); border-color: var(--accent-color); }
.scroll-btn.left { left: 10px; }
.scroll-btn.right { right: 10px; }
.scroll-btn:disabled { opacity: 0.2; cursor: not-allowed; backdrop-filter: none; }
.author-layout { display: flex; align-items: flex-start; gap: 40px; }
.author-image-column { flex: 0 0 350px; }
.author-image-column img { width: 100%; border-radius: var(--border-radius); box-shadow: 0 8px 25px rgba(0,0,0,0.5); }
.author-text-column { flex: 1; text-align: left; }
.author-text-column p { margin-bottom: 1.5em; line-height: 1.8; }
.author-text-column p:last-child { margin-bottom: 0; }
.buy-section { text-align: center; }
.buy-links { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; margin-top: 30px; }
.buy-btn { padding: 15px 30px; border-radius: 50px; font-weight: 700; text-transform: uppercase; color: #fff; text-decoration: none; transition: all var(--transition-speed) ease; position: relative; }
.buy-btn.amazon { background-color: #FF9900; } .buy-btn.kobo { background-color: #4C0084; } .buy-btn.google { background-color: #4285F4; }
.buy-btn:hover { transform: translateY(-5px); }
.buy-btn.disabled { background-color: #555; cursor: not-allowed; filter: grayscale(80%); }
.buy-btn.disabled:hover { transform: none; }
.buy-btn[data-tooltip]::after { content: attr(data-tooltip); position: absolute; bottom: 110%; left: 50%; transform: translateX(-50%); background-color: #111; color: #fff; padding: 8px 12px; border-radius: var(--border-radius); font-size: 0.9rem; white-space: nowrap; opacity: 0; visibility: hidden; transition: opacity var(--transition-speed) ease, visibility var(--transition-speed) ease; z-index: 20; }
.buy-btn.disabled:hover[data-tooltip]::after { opacity: 1; visibility: visible; }

/* Sezione Contatti */
.contact-section { text-align: center; }
#contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
}
#contact-form .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
#contact-form input, 
#contact-form textarea {
    padding: 15px;
    font-size: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid #30363d;
    background-color: var(--primary-color);
    color: var(--text-color);
    font-family: var(--font-body);
    width: 100%;
}
#contact-form textarea {
    resize: vertical;
}
#contact-form button {
    align-self: center;
    width: auto;
}

.rating-section { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.stars-container { display: inline-flex; flex-direction: row-reverse; }
.stars-container .star { font-size: 2.5rem; color: #444; cursor: pointer; transition: color 0.2s ease-out; }
.stars-container:hover .star, .stars-container .star.hover, .stars-container .star.selected { color: #f0ad4e; }
.stars-container .star:hover ~ .star, .stars-container .star.hover ~ .star, .stars-container .star.selected ~ .star { color: #f0ad4e; }

/* MODIFICA QUI: Nasconde il campo anti-spam */
.honeypot {
    display: none;
}
#form-status { margin-top: 15px; font-weight: bold; min-height: 20px; }

footer { text-align: center; padding: 30px 20px; background-color: rgba(13, 17, 23, 0.9); border-top: 1px solid #30363d; }
.cookie-banner { position: fixed; bottom: 0; left: 0; width: 100%; background-color: rgba(13, 17, 23, 0.95); backdrop-filter: blur(5px); color: var(--text-color); padding: 20px; box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.4); z-index: 3000; display: none; align-items: center; justify-content: center; gap: 20px; flex-wrap: wrap; transform: translateY(100%); transition: transform 0.5s ease-in-out; }
.cookie-banner.show { display: flex; transform: translateY(0); }
.cookie-banner .cookie-text { margin: 0; text-align: center; max-width: 800px; }
.cookie-banner .btn-primary { flex-shrink: 0; padding: 10px 25px; }
/* MODALE - Stili Generali e per Fazioni/Galleria */
.modal { position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.85); display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: opacity var(--transition-speed) ease; }
.modal.show { opacity: 1; visibility: visible; }
.modal-content { background-color: var(--secondary-color); padding: 30px; border-radius: var(--border-radius); width: 90%; max-width: 700px; position: relative; text-align: center; max-height: 90vh; overflow-y: auto; }
.close-button { color: var(--text-color); font-size: 2.5rem; position: absolute; top: 10px; right: 20px; cursor: pointer; z-index: 15; line-height: 1; }
.close-button:hover { color: var(--accent-color); }
#modalName { font-family: var(--font-heading); font-size: 2.2rem; margin-bottom: 25px; color: #f0f6fc; }
.modal-content img { max-width: 80%; border-radius: var(--border-radius); margin-bottom: 0; }
.modal.faction-mode h3, .modal.gallery-mode h3 { font-family: var(--font-heading); font-size: 2.2rem; margin-bottom: 25px; color: #f0f6fc; }
.modal.faction-mode img { max-width: 80%; border-radius: var(--border-radius); }
.modal.faction-mode .description-box { text-align: left; }
.stats-box { background-color: var(--primary-color); border: 1px solid #30363d; border-radius: var(--border-radius); padding: 25px; margin: 30px auto 0 auto; max-width: 80%; }
.stats-box:last-of-type { margin-bottom: 0; }
.stats-title { font-family: var(--font-heading); text-align: center; font-size: 1.5rem; margin-bottom: 25px; color: var(--text-color); }
.stats-section { display: grid; gap: 20px; padding-bottom: 15px; margin-bottom: 15px; border-bottom: 1px solid #30363d; }
.stats-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.stats-attributes { grid-template-columns: repeat(5, 1fr); text-align: center; }
.stats-traits { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stats-powers { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat-item { text-align: left; }
.stat-label { font-size: 0.8rem; color: #8b949e; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.stat-value { font-size: 1.1rem; font-weight: bold; color: var(--text-color); }
.stat-value.stat-max { color: var(--accent-color); }
.stat-value.stat-min { color: var(--red-color); }
.stats-quote { text-align: center; border-bottom: none; }
.stats-quote .stat-value { font-family: var(--font-body); font-style: italic; font-weight: normal; color: var(--text-color); font-size: 1.1rem; line-height: 1.5; max-width: 80%; margin: 0 auto; }
.description-box p { text-align: left; white-space: pre-wrap; line-height: 1.8; color: var(--text-color); }
.modal-nav-btn { position: fixed; top: 50%; transform: translateY(-50%); background-color: rgba(13, 17, 23, 0.8); color: white; border: 1px solid #444; border-radius: 50%; width: 50px; height: 50px; font-size: 2rem; cursor: pointer; transition: all 0.3s ease; z-index: 2001; display: none; }
.modal-nav-btn:hover { background-color: var(--accent-color); border-color: var(--accent-color); }
.modal-nav-btn.prev { left: 20px; }
.modal-nav-btn.next { right: 20px; }
.modal.gallery-mode #modalName { font-size: 1.5rem; margin-bottom: 15px; font-family: var(--font-body); }
.modal.gallery-mode .modal-nav-btn { display: block; }
.centered-scroller { justify-content: center; gap: 30px; }
.gallery-item {
    scroll-snap-align: start;
	position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
    aspect-ratio: 1 / 1;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: transform 0.4s ease-out, box-shadow 0.4s ease-out;
}
.gallery-item:hover { transform: translateY(-10px); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease-out; }
.gallery-item:hover img { transform: scale(1.1); }
.gallery-item-title { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%); color: #fff; padding: 2rem 1rem 1rem 1rem; text-align: center; font-weight: bold; transform: translateY(100%); transition: transform 0.4s ease-out; pointer-events: none; }
.gallery-item:hover .gallery-item-title { transform: translateY(0); }
/* --- NUOVI STILI PER I LINK SOCIAL --- */
.social-links {
    margin-top: 2rem;
    background-color: var(--primary-color); /* Sfondo più scuro per il box */
    border: 1px solid #30363d;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center; /* Centra tutto il contenuto del box */
    gap: 1rem;
}

.social-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700; /* Grassetto */
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.social-icons-container {
    display: flex;
    gap: 1.5rem;
    justify-content: center; /* Assicura che le icone siano centrate */
}

.social-icon {
    display: inline-block;
    width: 40px;
    height: 40px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.social-icon svg {
    width: 100%;
    height: 100%;
    fill: var(--text-color);
    transition: fill 0.3s ease;
}

.social-icon:hover {
    transform: translateY(-5px);
    opacity: 0.8;
}

.social-icon:hover svg {
    fill: var(--accent-color);
}
.nav-open .nav-links { display: flex; position: fixed; top: 0; right: 0; height: 100vh; width: 100%; max-width: 300px; flex-direction: column; justify-content: center; align-items: center; gap: 40px; background-color: rgba(13, 17, 23, 0.98); backdrop-filter: blur(10px); }
.nav-open .nav-links li { margin-left: 0; }
.nav-open .nav-links a { font-size: 1.5rem; }

/* ========================================= */
/* === STILI PER LA SEZIONE RECENSIONI === */
/* ========================================= */
#reviews-section .scroller-list {
    align-items: stretch; /* Assicura che le card abbiano la stessa altezza */
}

.review-card {
    /* DIMENSIONI E STRUTTURA */
    width: 300px;
    min-width: 300px;
    flex-shrink: 0;
    
    /* ASPETTO GRAFICO */
    background-color: var(--primary-color);
    background-image: linear-gradient(to bottom, rgba(255,255,255,0.05), rgba(0,0,0,0.2));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    
    padding: 20px;
    display: flex;
    flex-direction: column;
    
    /* --- MODIFICA QUI --- */
    /* Prima era space-between, ora mettiamo flex-start */
    justify-content: flex-start; 
    gap: 5px; /* Aggiungiamo un piccolo gap generale per sicurezza */
    /* -------------------- */

    transition: transform 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
}
.review-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.6);
    border-color: var(--accent-color);
}
.review-text-preview {
    font-style: italic;
    line-height: 1.6;
    color: var(--text-color);
    margin-bottom: 10px;
}
.review-read-more {
    margin-top: auto; /* Questo spinge IL SOLO bottone in fondo, se c'è */
    padding-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: var(--accent-color);
    font-weight: bold;
    font-size: 0.85rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.review-card:hover .review-read-more {
    color: var(--hover-color);
}
/* Stili specifici per il Modale in modalità Review */
.modal.review-mode .modal-content {
    text-align: left;
    max-width: 600px;
}

.modal.review-mode h3 {
    font-family: var(--font-heading);
    color: #f0f6fc;
    border-bottom: 1px solid var(--accent-color);
    padding-bottom: 10px;
    display: inline-block;
    width: 100%;
}

.modal-review-content {
    padding: 10px;
}

.review-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0.5rem;
}

.review-author {
    font-weight: 700;
    font-size: 1.1rem;
    color: #f0f6fc;
}

.verified-badge {
    background-color: var(--accent-color);
    color: var(--primary-color);
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 50px;
    font-weight: bold;
    text-transform: uppercase;
}

.review-rating .star {
    font-size: 1.2rem;
    color: #444;
}

.review-rating .star.filled {
    color: #f0ad4e;
}

.review-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    margin: 1rem 0 0.5rem 0;
}

.review-format {
    font-size: 0.85rem;
    color: #8b949e;
    margin-bottom: 1.5rem;
}

.review-text {
    font-style: italic;
    line-height: 1.7;
    flex-grow: 1; /* Fa in modo che il testo occupi lo spazio rimanente */
}

.reviews-footer {
    text-align: center;
    margin-top: 2.5rem;
}

@media (max-width: 1200px) { /* O un'altra larghezza appropriata */
    .webnovel-actions .btn-primary[data-text-short]::before {
        content: attr(data-text-short); /* Usa il testo breve */
    }
    /* Nascondi il testo originale */
    .webnovel-actions .btn-primary[data-text-short] {
        font-size: 0; 
    }
}
@media (min-width: 901px) {
    .hero-layout { display: grid; grid-template-columns: 300px 1fr; grid-template-rows: auto auto auto; gap: 0 40px; align-items: center; text-align: left; }
    .hero-layout .book-cover { grid-column: 1 / 2; grid-row: 1 / 4; margin: 0; }
    .hero-layout h1 { grid-column: 2 / 3; grid-row: 1 / 2; text-align: left; margin: 0; }
    .hero-layout .subtitle { grid-column: 2 / 3; grid-row: 2 / 3; text-align: left; margin: 1.5rem 0; }
    .hero-layout .btn-primary { grid-column: 2 / 3; grid-row: 3 / 4; justify-self: start; }
	.social-links { justify-content: center;  align-items: center; /* Centra le icone su mobile */ }
	.hero-layout .hero-buttons { grid-column: 2 / 3; grid-row: 3 / 4; justify-self: start; }
}
@media (max-width: 900px) {
    h1 { font-size: 2.2rem; }
    h2 { font-size: 2rem; }
    section { padding: 30px 20px; }
    .logo { font-size: 1.5rem; }
    .scroller-list { padding-left: 20px; padding-right: 20px; margin-left: -20px; margin-right: -20px; }
    .centered-scroller { justify-content: flex-start; }
    .author-layout { flex-direction: column; text-align: center; }
    .author-image-column { width: 60%; max-width: 300px; flex-basis: auto; margin: 0 auto; }
}
@media (max-width: 768px) {
    .details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
    .detail-item { min-width: 0; }
    .scroller-list .data-card, .gallery-item { width: 75vw; max-width: 300px; }
    .stats-attributes { grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); }
    .modal-nav-btn { width: 40px; height: 40px; font-size: 1.5rem; }
    .modal-nav-btn.prev { left: 5px; }
    .modal-nav-btn.next { right: 5px; }
    #contact-form .form-grid { grid-template-columns: 1fr; }
	.scroll-btn { 
    width: 40px; 
    height: 40px; 
    font-size: 1.2rem; 
    }
	.navbar { padding-left: 120px; /* Spazio ridotto per il logo più piccolo */ }
    .modal.review-mode .modal-content {
        width: 95%;
        padding: 20px;
    }
}

/* REGOLE PER MOBILE */
@media (max-width: 480px) {
    .modal.character-mode .modal-content {
        width: 100%;
        padding: 20px 0;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch; 
    }
    .modal.character-mode .character-card-modal {
        margin: 0 15px;
    }
}
@media (min-width: 481px) {
    .modal.character-mode .modal-content {
        /* Ripristina la larghezza massima corretta solo per gli schermi grandi,
           allineando perfettamente il contenitore alla card. */
        max-width: 440px;
    }
}
/* =================================================================== */
/* === STILI PER LA SCROLLBAR PERSONALIZZATA DEL MODALE === */
/* =================================================================== */

/* Sposta la card leggermente a sinistra per fare spazio alla scrollbar a destra */
.modal.character-mode .modal-content {
    padding-right: 15px; /* Aggiunge spazio a destra */
}

/* Nasconde la scrollbar di default */
.modal.character-mode .modal-content::-webkit-scrollbar {
    display: 8px;
}

/* --- Stili per la nuova scrollbar --- */
/* La "traccia" su cui scorre la barra */
.modal-content::-webkit-scrollbar-track {
    background: transparent; /* Sfondo trasparente */
	margin-block: 20px;
}

/* La barra di scorrimento vera e propria */
.modal-content::-webkit-scrollbar {
    width: 8px; /* Larghezza della barra */
}

/* Il "pollice" della barra che si muove */
.modal-content::-webkit-scrollbar-thumb {
    background-color: #8a6f4d; /* Un marrone dorato preso dalla card */
    border-radius: 4px; /* Angoli arrotondati */
    border: 2px solid #3d342a; /* Bordo scuro per staccarla */
}
.character-card-modal::-webkit-scrollbar { width: 12px; }
.character-card-modal::-webkit-scrollbar-track { background: transparent; margin-block: 20px; }
.character-card-modal::-webkit-scrollbar-thumb { background-color: #8a6f4d; border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }
/* =================================================================== */
/* === STILI PER LA NUOVA CARD DEI PERSONAGGI DENTRO IL MODALE === */
/* =================================================================== */

/* Stile per il wrapper dell'immagine sulla card di anteprima */
.data-card-image-wrapper {
    position: relative;
    height: 380px;
}

/* Stile per il bottone sull'ANTEPRIMA (preview) */
.image-switch-button.preview {
    position: absolute;
    bottom: -15px; /* Sposta l'icona FUORI dal bordo inferiore */
    left: 50%;
    transform: translateX(-50%);
    width: 34px;
    height: 34px;
    background-color: rgba(0,0,0,0.7);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    cursor: pointer;
    z-index: 5;
    transition: all 0.2s ease-in-out;
    user-select: none;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.image-switch-button.preview:hover {
    background-color: var(--accent-color);
    transform: translateX(-50%) scale(1.1);
    border-color: var(--accent-color);
}


/* Stili specifici per il MODALE */
.modal.character-mode .modal-content {
    background: none; border: none; padding: 0;
        border-radius: 24px; max-height: 90vh; overflow-y: auto;
}
.character-card-modal {
    width: 440px; display: flex; flex-direction: column;
    position: relative; font-family: 'Cinzel', serif;
    background: url('images/card_base.jpg'); background-size: 100% 100%;
    border-radius: 24px; box-shadow: 0 20px 60px rgba(0,0,0,0.9);
}
.character-card-modal .close-button {
    position: absolute; top: 28px; right: 38px;
    font-size: 2.8rem; color: #c9ab84;
    text-shadow: 1px 1px 4px #000; z-index: 15;
}
.card-modal-top {
    width: 100%; height: 380px;
    background-image: url('images/card_overlay_top.png'); background-size: 100% 100%;
    position: relative;
}
.card-modal-middle {
    width: 100%; flex-grow: 1;
    padding: 20px 38px 25px 38px;
    display: flex; flex-direction: column; gap: 20px;
}
.card-modal-bottom {
    width: 100%; height: 120px;
    background-image: url('images/card_overlay_bottom.png'); background-size: 100% 100%;
    position: relative; flex-shrink: 0;
}
.card-modal-top .card-header {
    position: absolute; top: 20px;
    width: 100%; text-align: center;
    font-size: 1.5rem; letter-spacing: 2px;
    color: #e0d6c3; text-shadow: 1px 1px 3px #000;
}
.card-modal-top .card-portrait-container {
    position: absolute; top: 95px; left: 50%;
    transform: translateX(-50%);
    width: 192px; height: 192px;
    border-radius: 50%; overflow: hidden;
    background-color: #111; z-index: 1;
}
.card-modal-top .character-portrait {
    min-width: 100%; min-height: 100%;
    width: auto; height: auto;
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    object-fit: cover;
    transition: opacity 0.25s ease-in-out;
}
/* Stile per il bottone nel MODALE */
.card-modal-top .image-switch-button {
    position: absolute;
    top: calc(95px + 192px - 42px);
    left: calc(50% + 96px - 42px);
    width: 34px; height: 34px;
    background-color: rgba(0,0,0,0.7);
    color: white; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; cursor: pointer;
    z-index: 15;
    transition: background-color 0.2s;
    user-select: none;
}
.card-modal-top .image-switch-button:hover {
    background-color: var(--accent-color);
}
.card-modal-top .card-name-plaque {
    position: absolute; top: 320px; left: 50%;
    transform: translateX(-50%);
    width: 300px; padding: 5px 0;
    text-align: center; font-size: 1.6rem;
    font-weight: bold; color: #2e261e;
}
.card-modal-middle .card-stats-container {
    display: flex; justify-content: space-between;
    font-family: 'Open Sans', sans-serif; font-size: 1.1rem;
    padding: 15px; background-color: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius); border: 1px solid rgba(191, 168, 140, 0.2);
}
.card-modal-middle .stats-col { width: 48%; display: flex; flex-direction: column; gap: 12px; }
.card-modal-middle .stat-item { color: #bfa88c; font-weight: 600; display: flex; align-items: center; }
.card-modal-middle .stat-icon { width: 22px; height: 22px; margin-right: 12px; background-size: contain; background-repeat: no-repeat; background-position: center; flex-shrink: 0; }
.stat-icon.icon-for { background-image: url('images/icons/icon_for.png'); }
.stat-icon.icon-dex { background-image: url('images/icons/icon_dex.png'); }
.stat-icon.icon-int { background-image: url('images/icons/icon_int.png'); }
.stat-icon.icon-sag { background-image: url('images/icons/icon_sag.png'); }
.stat-icon.icon-car { background-image: url('images/icons/icon_car.png'); }
.stat-icon.icon-portatore { background-image: url('images/icons/icon_portatore.png'); }
.card-modal-middle .stat-value { margin-left: auto; font-weight: 700; text-align: center; min-width: 24px; }
.card-modal-middle .stat-value.checkbox { border: 2px solid #bfa88c; width: 22px; height: 22px; line-height: 18px; font-size: 1.4rem; font-weight: bold; }
.card-modal-middle .card-alignment { text-align: center; font-size: 1.25rem; font-style: italic; color: #bfa88c; padding: 5px; background-color: rgba(0, 0, 0, 0.2); font-weight: bold; border-radius: var(--border-radius); border: 1px solid rgba(191, 168, 140, 0.2); }
.card-modal-bottom .card-description-box {
    position: absolute; top: 25px; bottom: 20px;
    left: 85px; right: 50px;
    font-family: 'Open Sans', sans-serif; font-size: 0.95rem;
    text-align: left; color: #d1c8b7;
    overflow-y: auto; padding-right: 10px;
}
.card-modal-bottom .card-description-box p { margin: 0; line-height: 1.5; }
.card-description-box::-webkit-scrollbar { width: 4px; }
.card-description-box::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
.card-description-box::-webkit-scrollbar-thumb { background: #888; border-radius: 2px; }

/* ========================================= */
/* === STILI PER LA SEZIONE WEB NOVEL === */
/* ========================================= */
#short-stories .scroller-list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 320px;
    align-items: stretch;
}
.webnovel-card {
    background-color: var(--primary-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.webnovel-card-image-wrapper {
    position: relative;
    aspect-ratio: 16 / 9; 
}

.webnovel-card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
/* Effetto di interattività sull'immagine */
.clickable-archive {
    cursor: pointer;
}
.clickable-archive:hover img {
    transform: scale(1.1);
}
/* Stili per l'overlay dell'archivio sull'immagine */
.archive-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.clickable-archive:hover .archive-overlay {
    opacity: 1;
}
.archive-overlay-icon {
    font-size: 2.5rem;
}
.archive-overlay-text {
    font-weight: bold;
    font-size: 1rem;
    margin-top: 0.5rem;
}

/* Stili per i badge (NEW, conteggio capitoli) */
.card-badge {
    position: absolute;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    color: #fff;
    background-color: var(--accent-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
.new-badge {
    top: 10px;
    right: 10px;
    background-color: var(--red-color);
}
.count-badge {
    bottom: 10px;
    left: 10px;
}

/* Contenuto testuale della card */
.webnovel-card-content {
    padding: 1.5rem;
    text-align: left;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.webnovel-card-content h3 {
    text-align: center;
    margin-bottom: 0.5rem;
}
.webnovel-card-content p {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    flex-grow: 1;
    color: var(--text-color);
    line-height: 1.6;
}

/* Area del pulsante singolo */
.webnovel-actions {
    margin-top: auto;
}

/* Se ci sono DUE pulsanti, li mettiamo affiancati */
.webnovel-actions:has(.open-archive-btn) {
    grid-template-columns: 1fr 1fr;
}

.webnovel-actions .btn-primary {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 12px 15px; /* Aumentiamo leggermente il padding per dare aria */
}
.webnovel-actions .btn-primary::before {
    content: '▶️'; 
    font-size: 0.8rem;
}
/* Icona per il pulsante "Leggi su Wattpad" (per card con 1 solo capitolo) */
.webnovel-actions .btn-primary:not(:has(:empty))::before {
    content: '▶️'; 
    font-size: 0.8rem;
}
.webnovel-actions .btn-secondary {
    padding: 10px 15px;
    font-size: 0.85rem;
    white-space: nowrap; /* Evita che il testo vada a capo */
    overflow: hidden;
    text-overflow: ellipsis; /* Aggiunge "..." se il testo è troppo lungo */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px; /* Spazio tra icona e testo */
}

/* Aggiungiamo le icone! */
.webnovel-actions .btn-primary::before {
    content: '▶️'; /* Icona "Play" per l'ultimo capitolo */
    font-size: 0.8rem;
}
.webnovel-actions .open-archive-btn::before {
    content: '📚'; /* Icona "Libri" per l'archivio */
    font-size: 0.8rem;
}

/* Stile per rendere l'immagine cliccabile più evidente */
.clickable-archive {
    cursor: pointer;
    transition: transform 0.3s ease;
}
.clickable-archive:hover {
    transform: scale(1.05);
}

/* --- STILI PER IL MODALE ARCHIVIO --- */
.modal.archive-mode .modal-content {
    text-align: left;
}

.archive-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    text-align: center;
}

.archive-subtitle {
    text-align: center;
    color: var(--accent-color);
    font-weight: bold;
    margin-bottom: 2rem;
}

.archive-chapter-list {
    list-style: none;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 15px; /* Spazio per la scrollbar */
}

.archive-chapter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #30363d;
}
.archive-chapter-item:last-child {
    border-bottom: none;
}

.archive-chapter-info {
    display: flex;
    flex-direction: column;
}

.archive-chapter-title {
    font-weight: bold;
    font-size: 1.1rem;
}

.archive-chapter-date {
    font-size: 0.85rem;
    color: #8b949e;
}

.archive-chapter-item .btn-secondary {
    padding: 8px 20px;
    flex-shrink: 0; /* Impedisce al pulsante di rimpicciolirsi */
}

/* ========================================= */
/* === NUOVO LAYOUT GRIGLIA PER GALLERIA === */
/* ========================================= */

#gallery-section .scroller-list {
    /* Override delle regole generiche di .scroller-list */
    display: grid;
    grid-auto-flow: column; /* Gli elementi si dispongono in colonne, creando lo scroll orizzontale */
    
    /* Definiamo la nostra griglia: 3 righe alte 150px ciascuna */
    grid-template-rows: repeat(3, 150px);
    /* Ogni colonna (immagine) sarà larga 150px per essere quadrata */
    grid-auto-columns: 150px;
    
    gap: 15px; /* Spazio tra le immagini */

    /* Reset dei margini negativi che non servono più con la griglia */
    margin-left: 0;
    margin-right: 0;

    /* Manteniamo il padding per dare spazio ai lati */
    padding-left: 40px;
    padding-right: 40px;
}

#gallery-section .gallery-item {
    /* Rimuoviamo le vecchie dimensioni fisse per adattarsi alla griglia */
    width: auto;
    height: auto;
    aspect-ratio: 1 / 1; /* Assicura che siano sempre quadrate */
}

/* ========================================= */
/* === STILE PER IL LOGO FLUTTUANTE === */
/* ========================================= */

#floating-logo {
    position: fixed; /* Lo fissa rispetto alla finestra del browser */
    top: 20px;       /* Distanza dal bordo superiore */
    left: 20px;      /* Distanza dal bordo sinistro */
    z-index: 2000;   /* Lo mette sopra quasi tutto */
    width: 150px;    /* Larghezza del logo. Possiamo aggiustarla. */
    transition: transform 0.3s ease;
}

#floating-logo:hover {
    transform: scale(1.05); /* Un piccolo effetto al passaggio del mouse */
}

#floating-logo img {
    width: 100%;
    height: auto;
}

/* Adattamento per schermi piccoli */
@media (max-width: 768px) {
    #floating-logo {
        width: 100px; /* Riduciamo la dimensione su mobile */
        top: 15px;
        left: 15px;
    }
}

/* === FIX PER LAYOUT A GRIGLIA (v2) === */
.scroller-list[style*="grid"] {
    margin-left: 0;
    margin-right: 0;
}

/* ========================================= */
/* === FIX DEFINITIVO RECENSIONI === */
/* ========================================= */

#reviews-section .scroller-list {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 20px;
    padding: 20px 10px;
    align-items: stretch; /* Le card avranno tutte la stessa altezza */
    margin-left: 0;
    margin-right: 0;
}

.review-card {
    /* DIMENSIONI */
    width: 300px;
    min-width: 300px;
    flex-shrink: 0;
    
    /* STRUTTURA - QUI C'ERA IL PROBLEMA */
    display: flex;
    flex-direction: column;
    justify-content: flex-start !important; /* Forza tutto in alto */
    gap: 0; /* Gestiamo noi gli spazi manualmente */
    
    /* GRAFICA */
    background-color: var(--primary-color);
    background-image: linear-gradient(to bottom, rgba(255,255,255,0.05), rgba(0,0,0,0.2));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    padding: 20px;
    cursor: pointer;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.review-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.7);
}

/* --- GESTIONE SPAZI INTERNI (Così Franco non esplode) --- */

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 5px; /* Spazio sotto l'autore */
}

.review-author {
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
}

.verified-badge {
    font-size: 0.6rem;
    background-color: var(--accent-color);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: bold;
}

.review-rating {
    color: #FFD700;
    margin-bottom: 10px; /* Spazio sotto le stelle */
    line-height: 1;      /* Evita spazi extra verticali */
}

.review-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--text-color);
    margin: 0 0 5px 0;   /* Resetta margini nativi e metti solo 5px sotto */
    line-height: 1.3;
}

.review-format {
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 15px; /* Spazio prima del testo */
    font-style: italic;
}

.review-text-preview {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #ccc;
    margin: 0; /* Niente margini extra */
}

/* IL TRUCCO: Questo spinge il pulsante in fondo SOLO se esiste */
.review-read-more {
    margin-top: auto; 
    padding-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: var(--accent-color);
    font-weight: bold;
    font-size: 0.85rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}