/* --- VARIABILI GLOBALI (Design Tokens) --- */
:root {
    --bg-color: #0B0E14; /* Dark violet/blue */
    --bg-alt: #121621;
    --text-primary: #f0f2f5;
    --text-secondary: #a0aec0;
    
    --accent-primary: #6366f1; /* Indigo */
    --accent-secondary: #ec4899; /* Pink */
    --accent-gradient: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    --font-main: 'Outfit', sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* --- RESET & SETUP BASE --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- UTILITIES --- */
.highlight {
    color: var(--accent-primary);
    font-weight: 800;
}

.gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dark-alt-bg {
    background-color: var(--bg-alt);
}

/* --- NAVBAR GLASSMORPHISM --- */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(11, 14, 20, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    transition: var(--transition-smooth);
}

.navbar.scrolled {
    padding: 10px 0;
    background: rgba(11, 14, 20, 0.95);
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-text {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: var(--transition-smooth);
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-gradient);
    transition: var(--transition-smooth);
}

.nav-links a:hover {
    color: #fff;
}

.nav-links a:hover::after {
    width: 100%;
}

/* Hamburger for Mobile */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
}

.hamburger .line {
    width: 30px;
    height: 3px;
    background-color: var(--text-primary);
    transition: var(--transition-smooth);
}

/* --- CAPITOLO 1: HERO SECTION --- */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 100px 20px;
    text-align: center;
}

.hero-background {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 50% 30%, rgba(99, 102, 241, 0.15) 0%, transparent 60%);
    z-index: -1;
}

.hero-content {
    max-width: 800px;
    animation: fadeUp 1s ease-out forwards;
}

.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 24px;
    transition: background 0.4s, border-color 0.4s, color 0.4s;
}
.badge-pill.is-open {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.35);
    color: #10b981;
}
.badge-pill.is-closed {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
    color: #ef4444;
}
.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.badge-pill.is-open .badge-dot {
    animation: pulse-dot 1.8s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.7); }
}

.hero-title {
    font-size: clamp(3rem, 6vw, 5rem);
    line-height: 1.1;
    font-weight: 800;
    margin-bottom: 24px;
}

.hero-subtitle {
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    color: var(--text-secondary);
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-cta-group {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 14px 32px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1rem;
    text-decoration: none;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
    background: var(--glass-bg);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(4px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
}

/* Mouse Scroll */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
}

.mouse {
    width: 26px;
    height: 40px;
    border: 2px solid var(--text-secondary);
    border-radius: 20px;
    position: relative;
}

.mouse::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 6px;
    background: var(--text-secondary);
    border-radius: 2px;
    animation: scroll 2s infinite;
}

/* --- SECTIONS COMMON --- */
section {
    padding: 100px 20px;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 16px;
}

.section-desc {
    color: var(--text-secondary);
    font-size: 1.2rem;
}

/* --- CAPITOLO 2: REPARTI --- */
.departments-section {
    max-width: 1200px;
    margin: 0 auto;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.glass-card {
    background: var(--glass-bg);
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 40px 30px;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}

.glass-card:hover {
    transform: translateY(-10px);
    border-color: rgba(99, 102, 241, 0.4);
}

.glass-card:hover::before {
    opacity: 1;
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 24px;
    display: inline-block;
}

.dept-card h3 {
    font-size: 1.5rem;
    margin-bottom: 16px;
    font-weight: 600;
}

.dept-card p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* --- CAPITOLO 3: BACHECA NOVITÀ --- */
.carousel-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 20px;
}

.carousel-btn {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--accent-primary);
}

.carousel-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.carousel-container {
    flex: 1;
    overflow-x: scroll;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 20px 0;
    -ms-overflow-style: none;
    scrollbar-width: none;
    container-type: inline-size;
}
.carousel-container::-webkit-scrollbar {
    display: none;
}

.news-track {
    display: flex;
    gap: 20px;
}

.news-item {
    min-width: min(220px, 100cqi);
    width: min(220px, 100cqi);
    flex-shrink: 0;
    scroll-snap-align: start;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.news-item:hover {
    transform: scale(1.03);
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.25);
}

/* Cover immagine */
.news-cover {
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    flex-shrink: 0;
}

.news-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.news-cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.news-cover-placeholder span {
    font-size: 2rem;
    font-weight: 900;
    color: rgba(255,255,255,0.9);
    line-height: 1;
}

.news-cover-icon {
    font-size: 1.4rem;
    opacity: 0.7;
}

/* Tag + testo sotto la cover */
.news-tag {
    position: absolute;
    top: 12px; left: 12px;
    background: var(--accent-gradient);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.news-content {
    padding: 12px 14px 16px;
}

.news-content h4 {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-content p {
    color: var(--text-secondary);
    font-size: 0.72rem;
}

/* --- CAPITOLO 2b: CATALOGO --- */
.catalog-section {
    padding: 100px 40px;
}

.catalog-subheading {
    font-size: clamp(0.9rem, 1.5vw, 1.05rem);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    max-width: 1200px;
    margin: 0 auto 16px;
    padding: 0 4px;
}

.catalog-subheading + .catalog-grid {
    margin-bottom: 48px;
}

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.catalog-tile {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 28px 24px;
    text-decoration: none;
    color: var(--text-primary);
    border-radius: 20px;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.catalog-tile:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
}

.catalog-tile-emoji {
    font-size: 2.8rem;
    flex-shrink: 0;
    line-height: 1;
}

.catalog-tile-body {
    flex: 1;
    min-width: 0;
}

.catalog-tile-body h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.catalog-tile-body p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.catalog-tile-count {
    display: inline-block;
    background: var(--accent-gradient);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.catalog-tile-arrow {
    font-size: 1.2rem;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: transform 0.2s, color 0.2s;
}

.catalog-tile:hover .catalog-tile-arrow {
    transform: translateX(4px);
    color: var(--text-primary);
}

/* --- CAPITOLO 4: BANCONE (CONTATTI) --- */
/* ── SHOP ──────────────────────────────────────── */
.shop-section {
    padding: 80px 5%;
}
.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}
.shop-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.shop-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}
.shop-img-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--glass-bg);
}
.shop-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.shop-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 800;
    color: rgba(255,255,255,0.9);
    letter-spacing: 2px;
}
.shop-card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}
.shop-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.shop-tag {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.shop-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.shop-badge--printful {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
    border: 1px solid rgba(139, 92, 246, 0.3);
}
.shop-badge--gumroad {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
    border: 1px solid rgba(249, 115, 22, 0.3);
}
.shop-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.shop-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    flex: 1;
    margin: 0;
}
.shop-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
}
.shop-price {
    font-size: 1.3rem;
    font-weight: 800;
}
.shop-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
    white-space: nowrap;
}
@media (max-width: 768px) {
    .shop-grid {
        grid-template-columns: 1fr;
    }
}

.contact-section {
    max-width: 1000px;
    margin: 0 auto;
}

.contact-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    background: linear-gradient(145deg, var(--glass-bg), rgba(0,0,0,0.2));
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
}

.contact-info h2 {
    font-size: 2rem;
    margin-bottom: 16px;
}

.contact-info > p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.info-list {
    list-style: none;
    margin-bottom: 40px;
}

.info-list li {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.btn-whatsapp {
    background: #25D366;
    color: #fff;
    width: 100%;
}

.btn-whatsapp:hover {
    background: #128C7E;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.4);
}

.map-embed {
    border-radius: 16px;
    overflow: hidden;
    min-height: 300px;
    border: 1px solid var(--glass-border);
}

.map-embed iframe {
    display: block;
    width: 100%;
    min-height: 300px;
    border: none;
}

/* --- FOOTER --- */
.glass-footer {
    text-align: center;
    padding: 40px 20px;
    border-top: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.5);
}

.footer-small {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* --- ANIMATIONS & FAB --- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scroll {
    0% { opacity: 1; top: 6px; }
    100% { opacity: 0; top: 24px; }
}

@keyframes pulseEffect {
    0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.pulse-animation {
    animation: pulseEffect 2s infinite;
}

.fab-whatsapp {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #25D366;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
    text-decoration: none;
    z-index: 900;
    transition: var(--transition-smooth);
}

.fab-whatsapp:hover {
    transform: scale(1.1);
}

/* ════════════════════════════════════════════════
   SEZIONE: IL PASSATEMPO — Minigiochi
   ════════════════════════════════════════════════ */

.games-section {
    position: relative;
}

/* ── Tab Switcher ─────────────────────────────── */
.games-tabs-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 48px;
}

.games-tabs {
    display: inline-flex;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    padding: 6px;
    gap: 6px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.game-tab {
    padding: 10px 28px;
    border-radius: 50px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.game-tab.active {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.game-tab:not(.active):hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.game-panel {
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
}

/* ── Layout comune due colonne ────────────────── */
.game-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 32px;
    align-items: start;
}

/* ── CERCA PAROLE: griglia ────────────────────── */
.ws-grid {
    display: grid;
    gap: 2px;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    width: 100%;
    aspect-ratio: 1;
    max-width: 560px;
    margin: 0 auto;
}

.ws-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border-radius: 6px;
    font-size: clamp(0.55rem, 1.4vw, 0.9rem);
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    background: var(--glass-bg);
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}

.ws-cell:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.25);
}

.ws-cell.selecting {
    background: rgba(99, 102, 241, 0.3);
    border-color: var(--accent-primary);
}

.ws-cell.found {
    background: var(--accent-gradient);
    color: #fff;
    border-color: transparent;
}

/* ── CERCA PAROLE: sidebar ────────────────────── */
.ws-words-panel {
    padding: 24px;
    margin-bottom: 16px;
}

.ws-panel-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.ws-word-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 420px;
    overflow-y: auto;
}

.ws-word-list li {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    letter-spacing: 0.05em;
    transition: var(--transition-smooth);
}

.ws-word-list li.found {
    text-decoration: line-through;
    text-decoration-color: var(--accent-secondary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(236, 72, 153, 0.08));
    border-color: rgba(99, 102, 241, 0.25);
    color: var(--text-secondary);
}

.ws-controls {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ws-found-counter {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.ws-new-game {
    width: 100%;
}

/* ── SUDOKU: layout ───────────────────────────── */
.game-layout--sudoku {
    grid-template-columns: auto 280px;
    justify-content: center;
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 2px;
    width: min(504px, 90vw);
    aspect-ratio: 1;
    background: var(--glass-border);
    border: 2px solid var(--accent-primary);
    border-radius: 12px;
    padding: 2px;
    overflow: hidden;
}

.sudoku-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    font-size: clamp(0.85rem, 1.8vw, 1.2rem);
    font-weight: 700;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.15s;
    position: relative;
    line-height: 1;
}

.sudoku-cell.box-right  { border-right:  2px solid rgba(99, 102, 241, 0.5); }
.sudoku-cell.box-bottom { border-bottom: 2px solid rgba(99, 102, 241, 0.5); }

.sudoku-cell.prefill {
    background: rgba(255, 255, 255, 0.06);
    cursor: default;
    font-weight: 800;
}

.sudoku-cell.selected {
    background: rgba(99, 102, 241, 0.3);
    outline: 2px solid var(--accent-primary);
    outline-offset: -2px;
    z-index: 1;
}

.sudoku-cell.highlighted {
    background: rgba(99, 102, 241, 0.09);
}

.sudoku-cell.error {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

.sudoku-cell.correct {
    color: #10b981;
}

.sudoku-cell .pencil-notes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    height: 100%;
    padding: 1px;
}

.sudoku-cell .pencil-notes span {
    font-size: clamp(0.28rem, 0.75vw, 0.42rem);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* ── SUDOKU: sidebar ──────────────────────────── */
.sudoku-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sudoku-panel {
    padding: 20px;
}

.diff-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.diff-btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.85rem;
    min-width: 60px;
}

.diff-btn.active {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
    border-color: transparent;
}

.sudoku-numpad {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.numpad-btn {
    aspect-ratio: 1;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
}

.numpad-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--accent-primary);
}

.sudoku-pencil-toggle {
    width: 100%;
    font-size: 0.85rem;
}

.sudoku-pencil-toggle.pencil-active {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.sudoku-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sudoku-actions .btn {
    width: 100%;
    font-size: 0.9rem;
}

.sudoku-status {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
    min-height: 1.2em;
}

/* ── Overlay vittoria (comune) ────────────────── */
.game-win-overlay {
    position: absolute;
    inset: 0;
    background: rgba(11, 14, 20, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    z-index: 10;
}

.game-win-overlay[hidden] {
    display: none;
}

.game-win-card {
    text-align: center;
    padding: 48px 40px;
    max-width: 360px;
}

.win-emoji {
    font-size: 3.5rem;
    margin-bottom: 16px;
}

.game-win-card h3 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.game-win-card p {
    color: var(--text-secondary);
    margin-bottom: 28px;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        flex-direction: column;
        gap: 0;
        background: rgba(11, 14, 20, 0.97);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--glass-border);
        padding: 16px 0;
    }
    .nav-links li a {
        display: block;
        padding: 14px 24px;
        font-size: 1.2rem;
    }
    .navbar.nav-open .nav-links {
        display: flex;
    }
    /* Animazione hamburger → X */
    .navbar.nav-open .hamburger .line:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }
    .navbar.nav-open .hamburger .line:nth-child(2) {
        opacity: 0;
    }
    .navbar.nav-open .hamburger .line:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }
    .hamburger {
        display: flex;
    }
    .contact-panel {
        grid-template-columns: 1fr;
    }
    .hero-cta-group {
        flex-direction: column;
    }
    /* Giochi responsive */
    .game-layout,
    .game-layout--sudoku {
        grid-template-columns: 1fr;
    }
    .game-layout--sudoku {
        justify-content: unset;
    }
    .ws-grid {
        max-width: 100%;
    }
    .sudoku-grid {
        width: min(360px, 95vw);
    }
    .sudoku-sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
    }
    .sudoku-panel {
        flex: 1 1 140px;
    }
}

/* ── CHAT WIDGET ─────────────────────────────────────────── */
#chat-widget {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 900;
}

#chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    font-size: 1.5rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.45);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(99, 102, 241, 0.6);
}

#chat-panel {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 0;
    width: 300px;
    background: rgba(15, 17, 35, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
    transform-origin: bottom left;
    transition: opacity 0.2s ease, transform 0.2s ease;
    opacity: 1;
    transform: scale(1);
}

#chat-panel.chat-hidden {
    display: none;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(236,72,153,0.15));
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

#chat-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.15s;
}
#chat-close:hover { color: var(--text-primary); }

#chat-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 360px;
    overflow-y: auto;
}

.chat-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.82rem;
    line-height: 1.5;
    max-width: 100%;
}

.chat-bubble.bot {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.chat-bubble.user {
    background: linear-gradient(135deg, rgba(99,102,241,0.3), rgba(236,72,153,0.2));
    border: 1px solid rgba(99,102,241,0.3);
    color: var(--text-primary);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

.chat-opt {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.8rem;
    padding: 9px 14px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
}

.chat-opt:hover {
    background: rgba(99,102,241,0.2);
    border-color: rgba(99,102,241,0.4);
}

.chat-opt.back {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-top: 4px;
}

.chat-opt a {
    color: inherit;
    text-decoration: none;
    display: block;
}

@media (max-width: 480px) {
    #chat-widget { bottom: 20px; left: 16px; }
    #chat-panel { width: 260px; }
    #chat-toggle { width: 52px; height: 52px; }
}
