/* ---------- Palette (tirée du logo : violet, or, vert) ---------- */
:root {
    --violet-900: #1a0a33;
    --violet-700: #3a1a66;
    --violet-500: #6a3db8;
    --or: #e6c25a;
    --or-clair: #fff0b8;
    --vert: #5be37d;
    --lilas: #cdb8ff;
    --texte: #fff6da;
    --panel: rgba(22, 8, 44, .74);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
    font-family: system-ui, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--texte);
    background: var(--violet-900) url('../img/site/Fond_Or.jpg') no-repeat center / cover fixed;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
body::before {               /* voile sombre pour la lisibilité */
    content: "";
    position: fixed; inset: 0;
    background: linear-gradient(180deg, rgba(20,6,40,.55), rgba(20,6,40,.85));
    z-index: -1;
}

/* ---------- En-tête ---------- */
.top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 24px;
    padding: 12px 24px;
    background: rgba(20, 6, 40, .6);
    border-bottom: 1px solid rgba(230, 194, 90, .3);
    backdrop-filter: blur(8px);
}
.brand {
    display: flex; align-items: center; gap: 12px;
    color: var(--or); text-decoration: none;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.6rem; letter-spacing: .12em;
}
.brand img { width: 44px; height: 44px; border-radius: 10px; }
.tagline { flex: 1 1 300px; margin: 0; color: var(--or-clair); font-size: .95rem; opacity: .9; }

.flags { display: flex; align-items: center; gap: 8px; }
.flags-label { font-size: .8rem; color: var(--lilas); margin-right: 4px; }
.flag {
    padding: 0; border: 2px solid transparent; border-radius: 6px;
    background: none; cursor: pointer; opacity: .55;
    transition: opacity .15s, transform .15s, border-color .15s;
}
.flag img { display: block; width: 36px; height: 24px; object-fit: cover; border-radius: 4px; }
.flag:hover { opacity: 1; transform: translateY(-1px); }
.flag[aria-pressed="true"] { opacity: 1; border-color: var(--or); }

/* ---------- Mise en page ---------- */
main {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(280px, 360px) 1fr;
    gap: 20px;
    padding: 20px 24px;
    align-items: start;
}
.panel {
    background: var(--panel);
    border: 1px solid rgba(230, 194, 90, .25);
    border-radius: 16px;
    padding: 18px;
    backdrop-filter: blur(10px);
}
h1 { margin: 0 0 12px; font-size: 1.1rem; color: var(--or); font-weight: 600; letter-spacing: .06em; }
.msg { margin: 8px 0 0; font-size: .9rem; color: var(--lilas); }
.msg.err { color: #ffb4a8; }
.msg:empty { display: none; }

/* ---------- Recherche ---------- */
#q {
    width: 100%; padding: 10px 14px; margin-bottom: 14px;
    border-radius: 999px; border: 1px solid rgba(230,194,90,.4);
    background: rgba(0,0,0,.35); color: var(--texte); font-size: 1rem;
}
#q::placeholder { color: rgba(255,246,218,.5); }
#q:focus { outline: 2px solid var(--or); }

.alphabet { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.alphabet button {
    width: 30px; height: 30px; padding: 0;
    border-radius: 8px; border: 1px solid rgba(230,194,90,.35);
    background: rgba(255,255,255,.05); color: var(--or-clair);
    font-size: .9rem; cursor: pointer;
}
.alphabet button:disabled { opacity: .25; cursor: default; }
.alphabet button:not(:disabled):hover { background: rgba(230,194,90,.25); }
.alphabet button[aria-pressed="true"] { background: var(--or); color: var(--violet-900); font-weight: 700; }

#songlist { list-style: none; margin: 14px 0 0; padding: 0; max-height: 50vh; overflow: auto; }
#songlist li button {
    width: 100%; text-align: left; padding: 10px 12px; margin-bottom: 4px;
    border-radius: 10px; border: 1px solid transparent;
    background: rgba(255,255,255,.04); color: var(--texte); cursor: pointer;
    font-size: 1rem;
}
#songlist li button small { display: block; color: var(--lilas); font-size: .8rem; }
#songlist li button:hover { background: rgba(230,194,90,.15); }
#songlist li button[aria-current="true"] { border-color: var(--or); background: rgba(230,194,90,.2); }

/* ---------- Lecteur ---------- */
#now-title { margin: 0; font-family: Georgia, serif; font-size: 1.7rem; color: var(--or); }
#now-artist { margin: 2px 0 12px; color: var(--lilas); min-height: 1.2em; }
audio { width: 100%; margin-bottom: 8px; }

/* ---------- Paroles défilantes ---------- */
#lyrics {
    position: relative;
    height: 56vh;
    min-height: 320px;
    overflow-y: auto;
    padding: 28vh 12px;                 /* permet de centrer la 1re et la dernière ligne */
    scrollbar-width: thin;
    scrollbar-color: var(--violet-500) transparent;
    /* fondu en haut et en bas */
    -webkit-mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent);
            mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent);
}
.pair {
    margin: 0 0 22px;
    text-align: center;
    cursor: pointer;
    opacity: .35;
    transform: scale(.94);
    transition: opacity .35s, transform .35s;
}
.pair.active { opacity: 1; transform: scale(1); }
.pair .orig { font-size: 1.55rem; line-height: 1.3; color: var(--or-clair); }
.pair .trad { margin-top: 4px; font-size: 1.15rem; line-height: 1.3; color: var(--lilas); font-style: italic; }
.pair.active .orig { text-shadow: 0 0 18px rgba(230,194,90,.45); }
.pair.active .trad { color: #e6d9ff; }

.section {
    margin: 30px 0 14px; text-align: center;
    font-size: .85rem; letter-spacing: .18em; text-transform: uppercase;
    color: var(--vert);
}
.gap { height: 12px; }

/* ---------- Pied de page ---------- */
footer { text-align: center; padding: 14px; color: var(--or-clair); background: rgba(20,6,40,.7); font-size: .85rem; }
footer p { margin: 0; }

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
    main { grid-template-columns: 1fr; padding: 14px 16px; }
    .top { padding: 10px 16px; }
    #songlist { max-height: 32vh; }
    #lyrics { height: 60vh; }
    .pair .orig { font-size: 1.3rem; }
    .pair .trad { font-size: 1.05rem; }
}

/* ---------- Téléphones : confort et zones tactiles ---------- */
@supports (height: 100dvh) {
    body { min-height: 100dvh; }
}
body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
footer { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }

@media (max-width: 820px) {
    .tagline { font-size: .85rem; flex-basis: 100%; order: 3; }
    .brand { font-size: 1.35rem; }
    .brand img { width: 38px; height: 38px; }
    .flags { margin-left: auto; }
    .panel { padding: 14px; }
    .alphabet { gap: 5px; }
    .alphabet button { width: 34px; height: 34px; }          /* ≥ 34 px : doigt à l'aise */
    #songlist li button { padding: 12px; }
    .pair { margin-bottom: 18px; }
}

/* Téléphone tenu en paysage : peu de hauteur → on rend la place aux paroles */
@media (max-height: 520px) and (orientation: landscape) {
    .tagline { display: none; }
    .top { padding: 6px 16px; }
    main { padding: 10px 16px; gap: 12px; }
    .browser { max-height: calc(100vh - 110px); overflow: auto; }
    #songlist { max-height: none; }
    #now-title { font-size: 1.3rem; }
    #now-artist { margin-bottom: 6px; }
    #lyrics { height: calc(100vh - 230px); min-height: 150px; padding: 15vh 12px; }
    .pair .orig { font-size: 1.25rem; }
    .pair .trad { font-size: 1rem; }
}
