:root {
    --vip-yellow: #ffd400;
    --background: #0b0b0d;
    --card: #17171b;
    --card-border: #26262c;
    --text: #f5f5f5;
    --muted: #a1a1aa;
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html,
body {
    margin: 0;
    /* Les stickers du fond dépassent volontairement des bords : pas de défilement latéral */
    overflow-x: hidden;
    background: var(--background);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
}

#menu {
    position: relative;
    max-width: 640px;
    margin: 0 auto;
    padding: max(16px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

/* ---------- En-tête ---------- */

.hero {
    text-align: center;
    padding: 8px 0 4px;
}

/* Logo « BIGBANG V.I.P » (couronne) : dessiné par l'utilisateur, remplace l'emoji */
.logo {
    display: block;
    width: min(168px, 49vw);
    height: auto;
    margin: 0 auto 2px;
    filter: drop-shadow(0 0 18px rgba(255, 212, 0, 0.55));
}

/* Stickers de fan parsemés en fond, derrière le texte, sur toute la hauteur de la page */
.sticker-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.sticker-bg img {
    position: absolute;
    width: min(230px, 44vw);
    height: auto;
    opacity: 0.4;
}

.sticker-bg .s1 { top: 1.0%; left: -8%; transform: rotate(-14deg); }
.sticker-bg .s2 { top: 6.5%; right: -10%; transform: rotate(11deg); }
.sticker-bg .s3 { top: 12.1%; left: 30%; transform: rotate(-6deg); }
.sticker-bg .s4 { top: 17.6%; left: -8%; transform: rotate(9deg); }
.sticker-bg .s5 { top: 23.1%; right: -10%; transform: rotate(-12deg); }
.sticker-bg .s6 { top: 28.6%; left: 30%; transform: rotate(7deg); }
.sticker-bg .s7 { top: 34.2%; left: -8%; transform: rotate(-9deg); }
.sticker-bg .s8 { top: 39.7%; right: -10%; transform: rotate(13deg); }
.sticker-bg .s9 { top: 45.2%; left: 30%; transform: rotate(-5deg); }
.sticker-bg .s10 { top: 50.8%; left: -8%; transform: rotate(10deg); }
.sticker-bg .s11 { top: 56.3%; right: -10%; transform: rotate(-13deg); }
.sticker-bg .s12 { top: 61.8%; left: 30%; transform: rotate(6deg); }
.sticker-bg .s13 { top: 67.4%; left: -8%; transform: rotate(-8deg); }
.sticker-bg .s14 { top: 72.9%; right: -10%; transform: rotate(12deg); }
.sticker-bg .s15 { top: 78.4%; left: 30%; transform: rotate(-7deg); }
.sticker-bg .s16 { top: 83.9%; left: -8%; transform: rotate(11deg); }
.sticker-bg .s17 { top: 89.5%; right: -10%; transform: rotate(-10deg); }
.sticker-bg .s18 { top: 95.0%; left: 30%; transform: rotate(8deg); }

/* Le contenu passe devant le fond parsemé */
#menu > :not(.sticker-bg) {
    position: relative;
    z-index: 1;
}

h1 {
    margin: 4px 0;
    font-size: 30px;
    letter-spacing: 0.08em;
    color: var(--vip-yellow);
}

.subtitle {
    margin: 0;
    color: var(--muted);
}

.main-actions {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.start-button {
    padding: 22px;
    border: 0;
    border-radius: 18px;
    background: var(--vip-yellow);
    color: #111;
    font: inherit;
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 0.1em;
    box-shadow: 0 0 32px rgba(255, 212, 0, 0.35);
    cursor: pointer;
}

.start-button:active,
.choice-button:active {
    transform: scale(0.97);
}

.mic-hint {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.badge {
    display: inline-block;
    margin: 12px 0 0;
    padding: 5px 12px;
    border-radius: 999px;
    background: #14261a;
    color: #86efac;
    font-size: 13px;
}

/* Vieux téléphones sans API Wake Lock : consigne visible, pas cachée dans les conseils */
.wake-hint {
    margin: 12px 0 0;
    padding: 10px 12px;
    border: 1px solid #7a5d00;
    border-radius: var(--radius);
    background: #2a2200;
    color: #ffe680;
    font-size: 13px;
    line-height: 1.45;
    text-align: left;
}

/* Vidéo anti-veille : présente mais invisible (iOS refuse de jouer un élément display:none) */
.awake-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 2px;
    height: 2px;
    opacity: 0.01;
    pointer-events: none;
}

/* ---------- Micro non autorisé ---------- */

.mic-notice {
    display: grid;
    gap: 10px;
    margin-top: 16px;
    padding: 14px;
    border: 1px solid #7f1d1d;
    border-radius: var(--radius);
    background: #2a1212;
    font-size: 14px;
    line-height: 1.45;
}

.mic-notice-title {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    font-weight: 600;
}

.mic-off-icon svg {
    flex: none;
    width: 26px;
    height: 26px;
}

.mic-notice summary {
    color: #fca5a5;
    font-weight: 700;
    cursor: pointer;
}

.mic-notice ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.mic-notice li + li {
    margin-top: 6px;
}

/* ---------- Conseils et réglages ---------- */

.tips {
    margin: 18px 0 12px;
    padding: 12px 14px;
    border-radius: var(--radius);
    background: var(--card);
    font-size: 14px;
    line-height: 1.5;
}

.tips summary {
    font-weight: 700;
    cursor: pointer;
}

.tips ul {
    margin: 8px 0 0;
    padding-left: 4px;
    list-style: none;
}

.settings {
    display: grid;
    gap: 8px;
}

.setting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
    border-radius: var(--radius);
    background: var(--card);
    cursor: pointer;
}

.setting small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.setting input[type="checkbox"] {
    flex: none;
    width: 24px;
    height: 24px;
    accent-color: var(--vip-yellow);
}

.setting input[type="color"] {
    flex: none;
    width: 52px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: none;
}

.setting-text input {
    flex: 1;
    min-width: 0;
    max-width: 60%;
    padding: 8px 10px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: #0f0f12;
    color: var(--text);
    font: inherit;
    font-size: 16px;
}

/* ---------- Grille des chansons ---------- */

.section-title {
    margin: 26px 4px 10px;
    color: var(--muted);
    font-size: 13px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.song {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-height: 84px;
    padding: 12px 12px 16px;
    overflow: hidden;
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.song:active {
    transform: scale(0.97);
}

/* Bandeau d'aperçu des couleurs de l'ambiance */
.song::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 7px;
    background: var(--preview);
}

.song .emoji {
    font-size: 20px;
}

.song-title {
    font-weight: 700;
    line-height: 1.25;
}

.song small {
    color: var(--muted);
    font-size: 12px;
}

/* ---------- Partage ---------- */

.share {
    display: grid;
    gap: 10px;
    margin-top: 28px;
}

.share-button {
    padding: 15px;
    border: 0;
    border-radius: var(--radius);
    background: var(--vip-yellow);
    color: #111;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.share-button.secondary {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--card-border);
}

footer {
    margin-top: 24px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
}

/* Réseaux de l'auteur (pub pour son prochain jeu) : deux demi-vignettes sous le partage */
.follow {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.social {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.social-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 10px;
    border-radius: var(--radius);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
}

.social-tile svg {
    width: 30px;
    height: 30px;
}

.social-x {
    border: 1px solid var(--card-border);
    background: #000;
}

.social-youtube {
    background: #ff0000;
}

.social-tile:active {
    transform: scale(0.97);
}

/* ---------- Choix après START ---------- */

.choice-panel {
    position: fixed;
    inset: 0;
    z-index: 15;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: max(20px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
    overflow-y: auto;
    background: var(--background);
}

.choice-featured {
    display: grid;
    gap: 10px;
}

.choice-subtitle {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

.choice-songs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

/* Chansons BIGBANG en grille compacte, sous les trois grands choix */
.choice-button.choice-song {
    min-height: 0;
    padding: 12px 10px;
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--text);
}

.choice-song .choice-name {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
}

.choice-big.choice-bang-bang-bang {
    background: linear-gradient(135deg, #ff1e1e 0 55%, #ffffff 55%);
    color: #fff;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.choice-title {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 18px;
    text-align: center;
}

.choice-button {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 15vh;
    justify-content: center;
    padding: 14px 16px;
    border: 0;
    border-radius: 22px;
    background: var(--vip-yellow);
    color: #111;
    font: inherit;
    text-align: center;
    cursor: pointer;
}

/* Aperçu des trois couleurs de BiiiG */
.choice-big.choice-biig {
    background: linear-gradient(135deg, #ffd400 0 33%, #ff1e1e 33% 66%, #1e5bff 66%);
    color: #fff;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.choice-name {
    font-size: 30px;
    font-weight: 900;
}

.choice-detail {
    font-size: 15px;
    font-weight: 600;
}

.choice-close {
    align-self: center;
    padding: 12px 24px;
    border: 1px solid var(--card-border);
    border-radius: 999px;
    background: var(--card);
    color: var(--text);
    font: inherit;
    cursor: pointer;
}

/* ---------- Écran lumineux ---------- */

#light {
    position: fixed;
    inset: 0;
    z-index: 10;
    background: #000;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

/* Icône discrète sur la lumière : ce téléphone suit un tempo fixe, pas la musique */
.mic-badge {
    position: absolute;
    top: max(12px, env(safe-area-inset-top));
    right: 12px;
    z-index: 1;
    display: flex;
    padding: 8px;
    border: 2px solid #ff4d4d;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    pointer-events: none;
}

.mic-badge svg {
    width: 22px;
    height: 22px;
}

#banner-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(5vw, env(safe-area-inset-top)) 5vw max(5vw, env(safe-area-inset-bottom));
    overflow: hidden;
    color: #000;
    font-weight: 900;
    line-height: 1.05;
    text-align: center;
    white-space: pre-wrap;
    word-break: keep-all;
}

#overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: max(20px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
    background: linear-gradient(
        rgba(0, 0, 0, 0.6), transparent 28%, transparent 70%, rgba(0, 0, 0, 0.6)
    );
    color: #fff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

/* En haut : titre à gauche, bouton Menu bien visible à droite (le bas de l'écran est
   parfois masqué par le bandeau Android « quitter le plein écran ») */
.overlay-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.overlay-title {
    min-width: 0;
    font-size: 24px;
    font-weight: 800;
    text-align: left;
}

.menu-button {
    flex: none;
    padding: 12px 18px;
    border: 0;
    border-radius: 999px;
    background: var(--vip-yellow);
    color: #111;
    font: inherit;
    font-size: 17px;
    font-weight: 800;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.overlay-hint {
    margin-top: 6px;
    color: var(--vip-yellow);
    font-size: 14px;
    font-weight: 700;
}

.overlay-status {
    margin-top: 6px;
    font-size: 13px;
    text-align: center;
    opacity: 0.9;
}

.overlay-bottom {
    display: grid;
    gap: 12px;
    /* Au-dessus du bandeau Android « quitter le plein écran » */
    padding-bottom: 36px;
}

.overlay-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* Rangée défilante : les trois premiers visibles d'emblée, le reste au doigt */
.quick-modes {
    justify-content: flex-start;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.quick-modes::-webkit-scrollbar {
    display: none;
}

/* Plus spécifique que « .overlay-controls button » (18 px), sinon cette règle est écrasée */
.overlay-controls.quick-modes button {
    flex: none;
    min-width: 0;
    padding: 11px 10px;
    font-size: 14px;
    white-space: nowrap;
}

.quick-modes .is-active {
    border-color: var(--vip-yellow);
    background: rgba(255, 212, 0, 0.3);
}

.overlay-controls button {
    min-width: 64px;
    padding: 16px 18px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font: inherit;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
}


/* ---------- QR code plein écran ---------- */

.qr-panel {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    background: #fff;
    color: #111;
    font-size: 20px;
    font-weight: 800;
    text-align: center;
}

.qr-panel img {
    width: min(82vw, 60vh);
    height: auto;
    image-rendering: pixelated;
}

.qr-panel p {
    margin: 0;
}

.qr-panel .qr-url {
    color: #444;
    font-size: 15px;
    font-weight: 600;
    word-break: break-all;
}

.qr-panel .qr-close {
    color: #666;
    font-size: 14px;
    font-weight: 500;
}
