/* --- STILI BRUTALIST (Black & White) --- */
:root {
    --bg-color: #f0f0f0;
    --card-bg: #fafbff66;
    --border-color: #000000;
    --accent-color: #c48c2e;
    --text-color: #000000;
}

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(#000 1px, transparent 1px);
    background-size: 20px 20px;
    font-family: 'Courier New', Courier, monospace;
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 40px 20px;
}

.container {
    background-color: var(--card-bg);
    padding: 40px;
    border: 4px solid var(--border-color);
    width: 950px;
    box-shadow: 12px 12px 0px var(--border-color);
    position: relative;
}

/* --- POPUP TOAST (COPIA CONFERMATA) --- */
#copyToast {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #000;
    color: #fff;
    padding: 40px 60px;
    border: 4px solid #fff;
    outline: 6px solid #000;
    box-shadow: 20px 20px 0px rgba(0,0,0,0.5);
    z-index: 10000;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 900;
    text-transform: uppercase;
    font-size: 2rem;
    text-align: center;
    pointer-events: none;
    white-space: nowrap;
}

/* --- ELEMENTI FLOTTANTI HEADER --- */
.version-tag {
    position: absolute;
    top: 30px;
    right: 85px; /* Lascia spazio al bottone Hint */
    background: #000;
    color: #fff;
    padding: 5px 10px;
    font-weight: bold;
    font-size: 0.8rem;
    border: 2px solid #000;
    text-transform: uppercase;
}

/* --- BOTTONE HINT (ICONA PULITA) --- */
.top-hint-btn {
    position: absolute;
    top: 30px; 
    right: 30px;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    cursor: pointer;
    z-index: 100;
    transition: transform 0.2s ease;
    width: auto;
    height: auto;
    text-decoration: none;
}

.top-hint-btn:hover {
    background: transparent;
    box-shadow: none;
    transform: scale(1.2);
}

.top-hint-btn:active {
    transform: scale(0.9);
}

.top-hint-btn img {
    width: 24px;       /* Dimensione esatta icona */
    height: 24px;
    object-fit: contain;
    display: block;
}

/* --- HEADER --- */
.header-row {
    display: flex;
    align-items: center;
    gap: 20px;
    border-bottom: 4px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.main-logo { width: 80px; height: auto; border: none; box-shadow: none; }

h1 {
    text-align: left; font-size: 3rem; margin: 0;
    text-transform: uppercase; font-weight: 900;
    letter-spacing: -2px; line-height: 0.9;
}

p.subtitle {
    text-align: left; font-weight: bold; margin-bottom: 40px;
    font-size: 1.1rem; text-transform: uppercase; letter-spacing: 1px;
}

/* --- TABS --- */
.tabs { display: flex; justify-content: flex-start; gap: 15px; margin-bottom: 40px; }

.tab-btn {
    background-color: #dad2d2; border: 3px solid var(--border-color);
    color: var(--text-color); padding: 12px 25px; cursor: pointer;
    font-size: 1rem; font-weight: 800; text-transform: uppercase;
    font-family: inherit; box-shadow: 5px 5px 0px var(--border-color);
    transition: all 0.1s ease; display: flex; align-items: center; gap: 10px;
}
.tab-icon { width: 24px; height: 24px; object-fit: contain; }
.tab-btn:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0px var(--border-color); }
.tab-btn.active { background-color: var(--accent-color); color: #fff; box-shadow: none; transform: translate(5px, 5px); }

#btn-lyrics { background-color: #F5DEB3; color: #000; }
#btn-lyrics.active { background-color: #F5DEB3; box-shadow: none; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* --- INPUTS --- */
.grid-container { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-bottom: 30px; }
.input-group { display: flex; flex-direction: column; }
label { font-size: 0.8rem; margin-bottom: 5px; font-weight: 900; text-transform: uppercase; }

select {
    background-color: #fff; color: #000; padding: 10px;
    border: 3px solid var(--border-color); border-radius: 0;
    font-size: 1rem; font-family: inherit; font-weight: bold;
    outline: none; width: 100%; cursor: pointer;
    box-shadow: 4px 4px 0px #ccc; transition: all 0.1s;
}
select:focus { background-color: #eee; box-shadow: 4px 4px 0px #000; }

.fx-section {
    background-color: #e0e0e0; border: 3px solid var(--border-color);
    padding: 20px; margin-bottom: 30px; box-shadow: 8px 8px 0px rgba(0,0,0,0.2);
}
.fx-title {
    grid-column: 1 / -1; font-size: 1.2rem; color: #000; font-weight: 900;
    margin-bottom: 15px; text-transform: uppercase; border-bottom: 3px solid #000;
    display: inline-block;
}

.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.3s; }

/* --- BUTTONS & OUTPUT --- */
.button-container { text-align: center; margin-bottom: 30px; margin-top: 20px; }
button.gen-btn {
    background: #000; color: #fff; border: 4px solid #000;
    padding: 20px 60px; font-weight: 900; font-size: 1.5rem;
    font-family: inherit; text-transform: uppercase; cursor: pointer;
    box-shadow: 8px 8px 0px #888; transition: all 0.1s;
}
button.gen-btn:hover { background: #fff; color: #000; box-shadow: 10px 10px 0px #000; transform: translate(-2px, -2px); }
button.gen-btn:active { transform: translate(4px, 4px); box-shadow: 0px 0px 0px #000; }

.output-wrapper { position: relative; background-color: #fff; border: 4px solid #000; box-shadow: 8px 8px 0px #000; }
textarea {
    width: 100%; height: 140px; background: transparent; border: none;
    color: #000; font-size: 1.2rem; font-weight: bold; resize: none;
    padding: 20px; padding-right: 60px; box-sizing: border-box;
    font-family: 'Courier New', Courier, monospace; line-height: 1.4;
}
textarea:focus { outline: none; background: #fafafa; }
.output-wrapper textarea {
  height: 140px;
}

.output-wrapper-song textarea {
  height: 340px;
  position: relative;
    background-color: #fff;
    border: 4px solid #000;
    box-shadow: 8px 8px 0px #000;
    display: flex;
	 flex: 1;
}
.output-wrapper,
.output-wrapper-song {
    margin-bottom: 40px;
}

.copy-btn {
    background: #fff;
    border: 2px solid #000;
    padding: 6px;
    cursor: pointer;
}

.copy-btn:hover { background: #fff; color: #000; }
.copy-btn:active { transform: scale(0.95); }

.copy-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* --- FOOTER --- */
footer { margin-top: 40px; text-align: center; border-top: 2px solid #000; padding-top: 20px; font-size: 0.9rem; font-weight: bold; }
footer a { color: #000; text-decoration: none; background: #fff; border: 2px solid #000; padding: 5px 10px; box-shadow: 4px 4px 0px #000; transition: 0.2s; }
footer a:hover { box-shadow: 2px 2px 0px #000; transform: translate(2px, 2px); background: #e0e0e0; }

/* --- LYRICS PAGE STYLES --- */
h3.section-title { font-size: 1.2rem; font-weight: 900; text-transform: uppercase; margin-bottom: 20px; border-bottom: 4px solid #000; padding-bottom: 10px; display: inline-block; }
.modifier-box { margin-bottom: 40px; border: 3px solid #000; padding: 25px; background-color: #f4f4f4; box-shadow: 8px 8px 0px #ddd; }
.modifier-input { width: 100%; padding: 15px; border: 2px solid #000; font-family: 'Courier New', Courier, monospace; font-weight: bold; font-size: 1.1rem; color: #000; outline: none; box-sizing: border-box; }
.modifier-input:focus { background-color: #fff; box-shadow: 6px 6px 0px #000; }
.structure-grid { display: flex; flex-wrap: wrap; gap: 15px; margin-bottom: 50px; border: 3px solid #000; padding: 30px; background: #fff; box-shadow: 10px 10px 0px #ccc; }
.struct-category { width: 100%; font-size: 0.9rem; font-weight: 900; text-transform: uppercase; margin-bottom: 15px; margin-top: 30px; border-bottom: 2px solid #000; padding-bottom: 5px; display: block; color: #444; }
.struct-category:first-of-type { margin-top: 0; }
.struct-btn { background: #fff; border: 2px solid #000; padding: 12px 20px; font-family: 'Courier New', Courier, monospace; font-weight: bold; font-size: 0.95rem; cursor: pointer; box-shadow: 4px 4px 0px #000; transition: all 0.1s; }
.struct-btn:hover { background: #000; color: #fff; transform: translate(-2px, -2px); box-shadow: 6px 6px 0px #666; }
.struct-btn:active { transform: translate(3px, 3px); box-shadow: 0px 0px 0px #000; }

/* --- HINT PAGE STYLES --- */
.hint-block { background: #fff; border: 3px solid #000; padding: 20px; margin-bottom: 30px; box-shadow: 8px 8px 0px #ccc; position: relative; }
.hint-title { font-size: 1.1rem; font-weight: 900; margin-bottom: 10px; border-bottom: 2px solid #000; padding-bottom: 5px; display: flex; justify-content: space-between; align-items: center; }
.audio-icon { width: 20px; height: 20px; margin-right: 10px; vertical-align: middle; }
.hint-text { width: 100%; background: #f4f4f4; border: 2px solid #000; padding: 15px; font-family: 'Courier New', Courier, monospace; font-weight: bold; font-size: 0.9rem; resize: none; height: 100px; box-sizing: border-box; cursor: pointer; }
.hint-text:hover { background: #fff; }
/* =========================================
   RESPONSIVE DESIGN (2025 READY)
   ========================================= */

@media (max-width: 768px) {
    body {
        padding: 10px; /* Meno spazio esterno */
    }

    .container {
        width: 100%; /* Occupa tutto lo spazio disponibile */
        padding: 20px;
        box-shadow: 6px 6px 0px #000; /* Ombra più piccola */
    }

    h1 {
        font-size: 2rem; /* Titolo più piccolo */
    }

    .header-row {
        flex-direction: column; /* Logo e Titolo uno sopra l'altro */
        text-align: center;
        gap: 10px;
    }

    .version-tag {
        position: relative; /* Non più assoluto per non coprire il resto */
        display: inline-block;
        right: auto;
        top: auto;
        margin-bottom: 10px;
    }

    .top-hint-btn {
        top: 10px;
        right: 10px;
    }

    /* Tabs: diventano una colonna o scorrono */
    .tabs {
        flex-direction: column;
        gap: 8px;
    }

    .tab-btn {
        width: 100%;
        justify-content: center;
    }

    /* Griglie: da 3 colonne passiamo a 1 o 2 */
    .grid-container {
        grid-template-columns: 1fr; /* Una sola colonna per i selettori */
    }

    .structure-grid {
        padding: 15px;
        justify-content: center;
    }

    .struct-btn {
        flex: 1 1 40%; /* I bottoni si allargano per riempire il cell */
        font-size: 0.8rem;
        padding: 10px;
        text-align: center;
    }

    /* Textarea: altezza ridotta per non occupare tutto lo schermo */
    textarea {
        height: 200px;
        font-size: 1rem;
    }

    #copyToast {
        width: 80%;
        font-size: 1.2rem;
        padding: 20px;
    }
}
/* Fix per i lettori audio multipli */
.gap-player {
    width: 100% !important;
    margin: 10px 0 20px 0 !important; /* Spazio sopra e sotto */
}

.hint-block {
    display: flex;
    flex-direction: column; /* Mette Titolo, Player e Textarea in fila perfetta */
    gap: 10px;
}
/* --- CUSTOM MODAL (AL POSTO DEL POPUP BROWSER) --- */
.modal-overlay {
    display: none; /* Nascosto di default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85); /* Sfondo scuro */
    z-index: 20000; /* Sopra a tutto */
    justify-content: center;
    align-items: center;
}

.modal-box {
    background: #fff;
    border: 4px solid #000;
    padding: 30px;
    width: 400px;
    text-align: center;
    box-shadow: 15px 15px 0px #000; /* Ombra Brutalist */
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: 20px;
    display: block;
}

.modal-btns {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.modal-btn {
    padding: 10px 30px;
    font-family: inherit;
    font-weight: bold;
    font-size: 1.2rem;
    cursor: pointer;
    border: 3px solid #000;
    text-transform: uppercase;
    transition: 0.1s;
}

.btn-yes {
    background-color: #000;
    color: #fff;
}
.btn-yes:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 #fff; }

.btn-no {
    background-color: #fff;
    color: #000;
}
.btn-no:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 #000; }
.btn-actions {
  position: absolute;
  bottom: 10px;
  right: 10px;

  display: flex;
  flex-direction: row-reverse; /* ← QUESTA */
  gap: 1px;

  transform: translate(-4px, -4px);
}

.btn-actions .copy-btn {
  line-height: 0;
}

.btn-actions .copy-btn svg {
  display: block;
}
.btn-copy:hover { color: #1e40ff; }
.btn-clear:hover { color: #c00000; }
.output-wrapper-song {
    position: relative !important;
}