/* ============================================================
 *  BASI DEL DESIGN (GLOBALE)
 *  ============================================================ */
body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #2c3e50;
    min-height: 100vh;
    overflow-x: hidden; /* Previene scorrimenti orizzontali imprevisti */
}

/* ============================================================
 *  INTESTAZIONI E TITOLI
 *  ============================================================ */
.main-title-container {
    text-align: center;
    padding: 30px 20px 10px 20px;
    width: 100%;
    box-sizing: border-box; /* Risolve il problema delle barre di scorrimento */
}

.main-title {
    font-size: 1.8rem;
    color: #2c3e50;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-weight: bold;
}

.main-title small {
    font-size: 1rem;
    color: #7f8c8d;
    font-weight: normal;
    display: block;
    text-transform: none;
}

/* ============================================================
 *  LAYOUT GRIGLIA (HOME E SELEZIONE ARGOMENTI)
 *  ============================================================ */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    width: 90%;
    max-width: 1100px;
    padding: 40px 0;
    margin: 0 auto;
    justify-content: center;
    box-sizing: border-box;
}

.topic-box {
    background: white;
    border-radius: 15px;
    padding: 35px 25px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: 2px solid #e1e4e8;
    transition: transform 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: inherit;
    box-sizing: border-box;
}

.topic-box:hover {
    transform: translateY(-5px);
    border-color: #3498db;
}

.topic-emoji {
    font-size: 3.5rem;
    display: block;
    margin-bottom: 15px;
}

.topic-title {
    font-size: 1.4rem;
    color: #2c3e50;
    font-weight: bold;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.topic-title small {
    font-size: 0.95rem;
    color: #7f8c8d;
    font-weight: normal;
    display: block;
    text-transform: lowercase;
}

.topic-title small::first-letter {
    text-transform: uppercase;
}

/* ============================================================
 *  STRUTTURA DELLE FLASHCARDS (SPECIFICO)
 *  ============================================================ */
.scene {
    width: 320px;
    max-width: 90vw; /* Adattabilità mobile */
    height: 280px;
    perspective: 1000px;
    cursor: pointer;
    margin: 20px auto;
}

.card {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.card.is-flipped {
    transform: rotateY(180deg);
}

.card__face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-radius: 15px;
    border: 2px solid #e1e4e8;
    padding: 25px 20px;
    box-sizing: border-box;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.card__face--front {
    background: #ffffff;
    color: #2c3e50;
}

.card__face--back {
    background: #3498db;
    color: white;
    transform: rotateY(180deg);
}

.hint-text {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    opacity: 0.6;
}

.word-text {
    font-size: 1.8rem;
    font-weight: bold;
    margin: 5px 0;
    line-height: 1.2;
}

.example-label {
    display: block;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 15px;
    margin-bottom: 4px;
    opacity: 0.8;
}

.example-phrase {
    font-size: 1rem;
    font-style: italic;
    line-height: 1.3;
}

/* ============================================================
 *  PULSANTI E AZIONI (UNIFICATI)
 *  ============================================================ */
.btn-start {
    background-color: #3498db;
    color: white !important;
    text-decoration: none !important;
    padding: 12px 30px;
    border-radius: 8px;
    font-weight: 600;
    display: inline-block;
    transition: all 0.2s ease;
    margin-top: 15px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(52, 152, 219, 0.2);
    text-align: center;
}

.btn-start:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(52, 152, 219, 0.3);
}

.audio-btn {
    margin-top: auto;
    margin-bottom: 5px;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    transition: transform 0.2s, background-color 0.2s;
    outline: none;
}

.card__face--front .audio-btn {
    background-color: #f0f2f5;
    color: #2c3e50;
}

.card__face--back .audio-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.controls {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.btn-nav {
    background-color: #2c3e50;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: opacity 0.2s;
}

#counter {
margin-top: 15px;
font-size: 0.9rem;
color: #7f8c8d;
font-weight: bold;
}

/* ============================================================
 *  FOOTER E NAVIGAZIONE SECONDARIA
 *  ============================================================ */
.footer-nav {
    padding: 20px 20px 50px 20px;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.back-link {
    color: #3498db;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    padding: 10px 25px;
    border: 1px solid #3498db;
    border-radius: 30px;
    transition: all 0.2s ease;
    display: inline-block;
}

.back-link:hover {
    background-color: #3498db;
    color: white;
}

.banner-box {
    width: 90%;
    max-width: 320px;
    height: 60px;
    background-color: #ffffff;
    margin: 10px auto 20px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #bdc3c7;
    border-radius: 8px;
    color: #95a5a6;
    font-size: 0.8rem;
}
