/* La Nuit des Nombres : même vert que le reste du site (#16855a, #5cc79a) */
#features.nn-section { padding-top: 1em; }
.nn-outil { max-width: 72em; width: 100%; box-sizing: border-box; margin: 0 auto; text-align: left; }
.nn { position: relative; font-family: 'Nunito', 'Segoe UI', Arial, sans-serif; color: #444; -webkit-user-select: none; user-select: none; }
.nn [hidden] { display: none !important; }
.nn h2, .nn h3, .nn b, .nn-go, .nn-touche, .nn-saisie, .nn-btn { font-family: 'Fredoka', 'Nunito', sans-serif; }
.nn h2 { margin: 0 0 .4em; color: #16855a; font-size: 1.6em; line-height: 1.2; }
.nn h3 { margin: 1.3em 0 .6em; color: #16855a; font-size: 1.05em; text-align: center; letter-spacing: .04em; }
.nn [role="button"] { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.nn [role="button"]:focus-visible { outline: 3px solid #f2b01e; outline-offset: 2px; }
.nn-rgpd { text-align: center; color: #999; font-size: .85em; margin: 1em 0 0; }
.nn-ecran { background: #fff; border: 2px solid #e5e5e5; border-radius: 1.2em; padding: 1em 1.2em 1.4em; }
.nn-info { color: #888; text-align: center; font-size: .95em; }
.nn-centre { text-align: center; margin-top: 1em; }
.nn-bts { display: flex; flex-wrap: wrap; gap: .8em; justify-content: center; margin-top: 1.2em; }
.nn-go { display: inline-flex; align-items: center; gap: .4em; padding: .7em 1.4em; border-radius: .8em; background: #16855a; color: #fff; font-weight: 600; font-size: 1.02em; box-shadow: 0 .2em 0 #0e5c3d; }
.nn-go:hover { background: #127048; }
.nn-go:active { transform: translateY(.15em); box-shadow: 0 .05em 0 #0e5c3d; }
.nn-go2 { background: #fff; color: #16855a; border: 2px solid #16855a; box-shadow: none; }
.nn-go2:hover { background: #eaf7f1; }
.nn-mini { display: inline-flex; align-items: center; justify-content: center; min-width: 2.4em; height: 2.4em; padding: 0 .7em; border-radius: 1.2em; background: #f3f5f4; color: #555; font-weight: 700; }
.nn-mini:hover { background: #eaf7f1; color: #16855a; }

/* Accueil */
.nn-intro { display: flex; align-items: center; gap: 1.2em; max-width: 52em; margin: 0 auto; }
.nn-intro p { line-height: 1.6; margin: 0; }
.nn-portrait { width: 160px; height: 120px; flex: none; animation: nn-hop 2.2s ease-in-out infinite; }
@keyframes nn-hop { 0%, 70%, 100% { transform: none; } 80% { transform: translateY(-.5em); } }
.nn-monde { border: 2px solid #e5e5e5; border-left: .6em solid var(--c); border-radius: 1em; padding: .7em .9em .9em; margin-bottom: .8em; background: linear-gradient(90deg, color-mix(in srgb, var(--f) 18%, #fff), #fff 60%); }
.nn-monde-tete { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3em 1em; margin-bottom: .6em; }
.nn-monde-tete b { color: #333; font-size: 1.1em; }
.nn-monde-tete span { color: #16855a; font-weight: 700; font-size: .9em; }
.nn-niveaux { display: grid; grid-template-columns: repeat(auto-fit, minmax(11em, 1fr)); gap: .6em; }
.nn-niv { display: flex; flex-direction: column; align-items: center; gap: .1em; padding: .6em .5em; border: 2px solid #e5e5e5; border-radius: .9em; background: #fff; text-align: center; transition: border-color .2s, transform .15s; }
.nn-niv b { color: #16855a; font-size: 1.15em; }
.nn-niv span { font-size: .88em; color: #666; line-height: 1.3; }
.nn-niv:hover { border-color: #5cc79a; transform: translateY(-2px); }
.nn-niv.off { opacity: .55; }
.nn-niv.off:hover { transform: none; border-color: #e5e5e5; }
.nn-et { color: #f2b01e; letter-spacing: .1em; font-size: 1.05em !important; }
.nn-et i { color: #ddd; font-style: normal; }
.nn-tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(14em, 1fr)); gap: .8em; }
.nn-tuile { display: flex; flex-direction: column; gap: .2em; padding: .85em 1em; border: 2px solid #e5e5e5; border-radius: 1em; color: #777; line-height: 1.4; text-align: center; transition: border-color .2s, transform .15s; }
.nn-tuile b { color: #16855a; font-size: 1.12em; font-weight: 600; }
.nn-tuile span { font-size: .88em; }
.nn-tuile:hover { border-color: #5cc79a; transform: translateY(-2px); }
.nn-tuile.actif { border-color: #16855a; box-shadow: 0 0 0 3px #d4efe3; background: #f6fcf9; }
.nn-regles { max-width: 52em; margin: 0 auto; }
.nn-regles ul { margin: 0; padding-left: 1.2em; line-height: 1.6; }
.nn-regles li { margin-bottom: .35em; list-style: disc; }

/* Le jeu : toujours entièrement visible à l'écran */
.nn-jeu { max-width: calc((100vh - 8em) * 768 / 448); margin: 0 auto; }
.nn-jeu.tactile { max-width: calc((100vh - 15em) * 768 / 448); min-width: min(100%, 32em); }
.nn-hud { display: flex; flex-wrap: wrap; align-items: center; gap: .4em 1.1em; padding: .5em .8em; margin-bottom: .5em; background: #fff; border: 2px solid #e5e5e5; border-radius: 1em; font-weight: 700; color: #333; }
.nn-titre { color: #16855a; font-family: 'Fredoka', 'Nunito', sans-serif; }
.nn-droite { margin-left: auto; display: flex; gap: .4em; }
.nn-cadre { position: relative; border-radius: 1em; overflow: hidden; border: 2px solid #e5e5e5; background: #cfe9f7; line-height: 0; }
.nn-toile { display: block; width: 100%; aspect-ratio: 768 / 448; touch-action: none; }
.nn-porte-q { position: absolute; left: 50%; top: .6em; transform: translateX(-50%); width: max-content; max-width: calc(100% - 1.2em); box-sizing: border-box; padding: .5em 1em .6em; background: rgba(255, 255, 255, .95); border: 3px solid #6b4226; border-radius: 1em; text-align: center; line-height: 1.35; box-shadow: 0 .4em 1em rgba(0, 0, 0, .2); animation: nn-pop .25s ease; }
.nn-porte-q > b { color: #6b4226; font-size: .9em; }
.nn-pq { font: 600 clamp(1.05em, 2.6vw, 1.5em)/1.4 'Fredoka', 'Nunito', sans-serif; color: #222; margin: .15em 0 .3em; }
.nn-pc { display: flex; flex-wrap: wrap; justify-content: center; gap: .4em .9em; font-weight: 700; color: #333; }
.nn-pc i { display: inline-block; min-width: 1.5em; border-radius: .4em; background: #6b4226; color: #fff; font-style: normal; text-align: center; }
.nn-voile { position: absolute; inset: 0; background: rgba(30, 50, 40, .45); display: flex; align-items: center; justify-content: center; line-height: 1.4; }
.nn-voile > div { background: #fff; border-radius: 1em; padding: 1em 1.6em; display: flex; flex-direction: column; gap: .7em; align-items: center; font-size: 1.2em; }
.nn-aide { text-align: center; color: #999; font-size: .85em; margin: .5em 0 0; }
.nn-pad { display: none; justify-content: space-between; gap: 1em; margin-top: .6em; touch-action: none; }
.tactile .nn-pad { display: flex; }
.tactile .nn-aide { display: none; }
.nn-pad-g, .nn-pad-d { display: flex; gap: .7em; }
.nn-btn { width: 4.4em; height: 4.4em; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #f3f5f4; border: 2px solid #d5dad7; color: #16855a; font-size: 1.5em; box-shadow: 0 .2em 0 #d5dad7; touch-action: none; cursor: pointer; }
.nn-btn.on { background: #d4efe3; transform: translateY(.12em); box-shadow: none; }
.nn-saut { background: #16855a; border-color: #0e5c3d; color: #fff; box-shadow: 0 .2em 0 #0e5c3d; width: 5.2em; height: 5.2em; }
.nn-saut.on { background: #127048; }

/* Fin de niveau */
.nn-fin { text-align: center; padding: 2em 1em; }
.nn-grand-et { font-size: 2.6em; }
.nn-bilan { display: inline-block; text-align: left; margin: .5em 0; padding: 0; line-height: 1.9; font-size: 1.1em; }
.nn-bilan li { list-style: none; }

/* Fenêtre de question (comme les autres jeux du site) */
#nn-modale { position: fixed; inset: 0; z-index: 10000; background: rgba(30, 50, 40, .5); display: flex; align-items: center; justify-content: center; padding: 1em; overflow: auto; }
#nn-modale > div { margin: auto; }
.nn-question { background: #fff; border-radius: 1.2em; width: 100%; max-width: 34em; padding: 1em 1.3em 1.3em; box-shadow: 0 1em 3em rgba(0, 0, 0, .25); border-top: .5em solid #f2b01e; animation: nn-pop .25s ease; }
@keyframes nn-pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.nn-porte-q { animation-name: nn-pop-h; }
@keyframes nn-pop-h { from { transform: translateX(-50%) scale(.6); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
.nn-q-haut { display: flex; flex-wrap: wrap; gap: .4em 1em; align-items: center; font-weight: 700; color: #555; }
.nn-etoiles { color: #f2b01e; letter-spacing: .1em; }
.nn-th { margin-left: auto; padding: .1em .7em; border-radius: 1em; background: #eaf7f1; color: #16855a; font-size: .8em; }
.nn-enonce { font: 600 clamp(1.4em, 3.6vw, 2.1em)/1.4 'Fredoka', 'Nunito', sans-serif; color: #222; text-align: center; margin: .7em 0 .5em; }
.nn-enonce small { display: block; font: 400 .45em/1.4 'Nunito', sans-serif; color: #888; margin-top: .4em; }
.nn-saisie { min-height: 1.6em; margin: 0 auto .6em; max-width: 12em; padding: .2em .6em; border: 3px solid #16855a; border-radius: .7em; text-align: center; font-size: 1.8em; font-weight: 600; color: #222; }
.nn-saisie.vide { color: #bbb; font-size: 1.3em; line-height: 1.6em; font-weight: 400; }
.nn-pave { display: grid; grid-template-columns: repeat(4, 1fr); gap: .45em; max-width: 19em; margin: 0 auto; }
.nn-touche { height: 2.6em; border-radius: .6em; background: #f3f5f4; display: flex; align-items: center; justify-content: center; font-size: 1.3em; font-weight: 600; color: #333; box-shadow: 0 .15em 0 #d5dad7; }
.nn-touche:active { transform: translateY(.1em); box-shadow: none; }
.nn-touche:hover { background: #eaf7f1; }
.nn-touche.ok { grid-column: span 2; background: #16855a; color: #fff; box-shadow: 0 .15em 0 #0e5c3d; }
.nn-verdict { text-align: center; font: 700 1.5em 'Fredoka', sans-serif; margin: .5em 0; animation: nn-pop .3s ease; }
.nn-verdict.ok { color: #16855a; } .nn-verdict.ko { color: #c0392b; font-size: 1.25em; }
.nn-verdict.crit { color: #d48c00; font-size: 1.8em; }
.nn-verdict small { font-size: .6em; } .nn-verdict b { color: inherit; }
.nn-correction { background: #f6fcf9; border-left: 4px solid #5cc79a; border-radius: .5em; padding: .7em 1em; line-height: 1.6; color: #333; }
.nn-chrono { position: relative; height: 2em; max-width: 22em; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .06); margin: 0 auto .7em; border-radius: 1em; background: #eef1ef; overflow: hidden; }
.nn-chrono > div { height: 100%; width: 100%; background: #16855a; border-radius: 1em; transition: width .1s linear, background .3s; }
.nn-chrono.crit > div { background: linear-gradient(90deg, #f2b01e, #ffd95e); }
.nn-chrono.urgent > div { background: #e0524d; }
.nn-chrono span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1em; color: #222; }
.nn .tn-f { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 .12em; line-height: 1.1; }
.nn .tn-f > span { padding: 0 .2em; }
.nn .tn-f > span:first-child { border-bottom: .08em solid currentColor; }
.nn .tn-rac { border-top: .08em solid currentColor; padding: 0 .1em; }
.nn sup { font-size: .6em; vertical-align: super; line-height: 0; }

#nn-toast { position: fixed; left: 50%; bottom: 1.5em; transform: translate(-50%, 1em); z-index: 10001; background: #333; color: #fff; padding: .6em 1.1em; border-radius: .8em; max-width: 90%; text-align: center; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
#nn-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* Plein écran (tablette projetée) : le jeu prend toute la hauteur */
.nn-outil:fullscreen { background: #fff; max-width: none; padding: .8em; overflow: auto; display: flex; flex-direction: column; justify-content: center; }
.nn-outil:fullscreen .nn-rgpd { display: none; }
.nn-outil:fullscreen .nn-jeu { width: min(100%, calc((100vh - 6.5em) * 768 / 448)); margin: 0 auto; }
.nn-outil:fullscreen .tactile { width: min(100%, calc((100vh - 12em) * 768 / 448)); }
.nn-outil:fullscreen .nn-ecran { max-height: calc(100vh - 2em); overflow: auto; }

@media (max-width: 640px) {
	.nn-intro { flex-direction: column; text-align: center; }
	.nn-btn { width: 3.6em; height: 3.6em; } .nn-saut { width: 4.4em; height: 4.4em; }
}

/* Vies perdues */
.nn-vies { display: inline-block; }
.nn-vies.perdu { color: #e0524d; animation: nn-secoue .35s ease 3; }
@keyframes nn-secoue { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.nn-vie { text-align: center; color: #c0392b; font-weight: 800; margin: .1em 0 .6em; }

/* Classes et mondes */
.nn-classes { grid-template-columns: repeat(4, 1fr); }
.nn-classe b { font-size: 1.5em !important; }
.nn-themes { margin: -.2em 0 .7em; font-size: .85em; color: #777; line-height: 1.4; }
@media (max-width: 640px) { .nn-classes { grid-template-columns: repeat(2, 1fr); } }

/* La Nuit des Nombres : réglages propres au jeu */
.nn-portrait { width: 160px; height: 120px; border-radius: 1em; background: #1d2b3f; }
.nn-chronos { grid-template-columns: repeat(4, 1fr); }
.nn-mondes { grid-template-columns: repeat(2, 1fr); }
.nn-monde-t { border-left: .6em solid var(--c); gap: .3em; }
.nn-monde-t .nn-lieu { color: #555; font-weight: 700; }
.nn-monde-t .nn-themes { font-size: .8em; color: #888; }
.nn-et { color: #f2b01e; letter-spacing: .1em; font-size: 1.15em !important; }
.nn-et i { color: #ddd; font-style: normal; }
.nn-jeu { max-width: calc((100vh - 8em) * 16 / 9); margin: 0 auto; }
.nn-jeu.tactile { max-width: calc((100vh - 9em) * 16 / 9); min-width: 0; }
.nn-toile { aspect-ratio: 16 / 9; background: #1d2b3f; }
.nn-cadre { background: #1d2b3f; }
.nn-aide-t { display: none; text-align: center; color: #999; font-size: .85em; margin: .5em 0 0; }
.tactile .nn-aide-t { display: block; }
.nn-hud > span { white-space: nowrap; }
.nn-q { color: #16855a; }

/* bandeau des feux follets */
.nn-ronde { position: absolute; left: 50%; bottom: .6em; transform: translateX(-50%); width: max-content; max-width: calc(100% - 1.2em); box-sizing: border-box; padding: .45em 1em .55em; background: rgba(255, 255, 255, .95); border: 3px solid #7b4fc9; border-radius: 1em; text-align: center; line-height: 1.3; pointer-events: none; animation: nn-pop-h .3s ease; }
.nn-ronde > b { color: #7b4fc9; font-size: .85em; }
.nn-rq { font: 600 clamp(1em, 2.4vw, 1.4em)/1.4 'Fredoka', 'Nunito', sans-serif; color: #222; margin: .1em 0 .3em; }
.nn-rq small { display: block; font: 400 .6em 'Nunito', sans-serif; color: #888; }
.nn-rchrono { height: .45em; border-radius: 1em; background: #eee; overflow: hidden; }
.nn-rchrono > div { height: 100%; background: #7b4fc9; transition: width .2s linear; }
@keyframes nn-pop-h { from { transform: translateX(-50%) scale(.6); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }

/* fenêtre de question : pouvoirs, coffres, boss */
.nn-question { max-width: 40em; }
.nn-q-boss { border-top-color: #7b4fc9; }
.nn-q-coffre { border-top-color: #a8702e; }
.nn-question h3 { margin: .6em 0 .5em; }
.nn-pouvoirs { grid-template-columns: repeat(auto-fit, minmax(12em, 1fr)); }
.nn-pouvoir { position: relative; padding-top: 1em; }
.nn-pouvoir .nn-nouv { color: #d48c00; font-weight: 800; }
.nn-num { position: absolute; top: .4em; left: .5em; width: 1.5em; height: 1.5em; border-radius: 50%; background: #eef1ef; color: #888; font: 700 .8em/1.5em 'Nunito', sans-serif; font-style: normal; text-align: center; }
.nn-enonce-r { font-size: clamp(1.1em, 2.6vw, 1.4em); }
.nn-enonce-r b { color: #a8702e; }
.nn-boites { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7em; }
.nn-boite { position: relative; display: flex; align-items: center; justify-content: center; min-height: 3.6em; padding: 1em .6em .7em; border: 3px solid #a8702e; border-radius: .9em; background: #fff8ec; color: #4a3200; font: 600 1.15em 'Fredoka', 'Nunito', sans-serif; text-align: center; box-shadow: 0 .2em 0 #a8702e; }
.nn-boite:hover { background: #ffefd2; }
.nn-boite:active { transform: translateY(.15em); box-shadow: none; }
.nn-gain { text-align: center; font-weight: 700; color: #16855a; line-height: 1.7; }
.nn-vie { text-align: center; color: #c0392b; font-weight: 800; margin: .1em 0 .6em; }
#nn-modale .nn-tuile b { font-size: 1.02em; }

.nn-outil:fullscreen .nn-jeu { width: min(100%, calc((100vh - 6.5em) * 16 / 9)); max-width: none; }

@media (max-width: 640px) {
	.nn-mondes, .nn-chronos { grid-template-columns: 1fr 1fr; }
	.nn-boites { grid-template-columns: 1fr; }
}
