@font-face {
	font-family: "Fighting Spirit TBS";
	src: url('font/Fighting Spirit 2.otf') format('opentype');
	font-weight: normal;
	font-style: normal;
}

@font-face {
	font-family: "Press Start P2";
	src: url('font/PressStart2P-Regular.ttf') format('opentype');
	font-weight: normal;
	font-style: normal;
}

body {
	font-family: Arial, sans-serif;
	background-color: #222;
	background: url(../images/background.jpg);
	background-repeat: no-repeat;
	background-size: 100%;
	color: white;
	margin: 0;
	padding: 2vh;
	display: flex;
	margin-top: 0.2vh;
	flex-direction: column;
	align-items: center;
	min-height: 100vh;
	height: 100%; 
	overflow: hidden
}

#main-ui {
	position: relative; 
	width: 100%;
	display: flex;
	flex-direction: column;	
	align-items: center;
}

#title{
	margin-top: 5vh;
	margin-bottom: 2vh;
	position: fixed;
	top: 20%;
	left: 50vw;
	transform: translate(-50%, -50%);
	width: auto;
	height: 50vh;
	aspect-ratio: 2/1;
	background: url(../images/title.png);
	background-repeat: no-repeat;
	background-size: 100%;
}

.subtitle{
	position: fixed;
	top: 50%;
	min-width: 10vw;
	height: 15vh;
	background-repeat: no-repeat;
	background-size: 100%;
}

button {
	font-family: inherit;
	font-weight: bold;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: background-color 0.3s ease;
	background-color: #00aaff;
	color: white;
	z-index:999;
}


#buttons {
	flex-wrap: wrap;
	gap: 0.25vh;
	top: 1vh;
	right: 1vw;
	position: absolute;
	display: flex;
	align-items: center;
}

#toggle-sound, #switshlag, #capture-btn{
	background: none;
	border: none;
	cursor: pointer;
	color: white;
	font-size: 5vh;
}

.players-container {
	flex-direction: column;
	align-items: center;
	margin-top: 10vh;
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	width: 100%;
	padding: 0 10vh;
	box-sizing: border-box;
}

/* Conteneur joueur individuel */
.player-wrapper {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.playerNumber {
	width: 16vh;
	height: 20vh;
	position: absolute;
	top: -10vh;
	left: -6vh;
	z-index: 2;
}

.press-space {
	font-size: 1.5vh;
	color: #f00;
	font-family: Press Start P2;
	font-weight: bold;
	opacity: 0;
	transition: opacity 0.8s ease-in-out;
	user-select: none;
	pointer-events: none;
	display: inline-block;
	margin-bottom:1vh;
}

.player {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
}

/* Quand l'image a la classe inactive, on fait clignoter le span dans le même parent */
.player img.inactive + .press-space {
	animation: pulseFade 1.6s infinite;
	opacity: 1; /* pour qu'on le voie */
}

@keyframes pulseFade {
	0%, 100% { opacity: 0.1; }
	50% { opacity: 1; }
}

.grid-wrapper {
	margin-top: 2vh;
	display: flex;
	flex-direction: column;
	gap: 1vh;
	align-items: center; /* centre les lignes horizontalement */
	width: 100%;
}

.grid-row {
	display: flex;
	gap: 1vh;
	justify-content: center; /* centre les éléments dans la ligne */
	flex-wrap: nowrap;
}

.character {
	width: 10vh;
	max-width: 60px;
	height: 10vh;
	max-height: 60px;
	padding: 0;
	margin: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: #333;
	border-radius: 10px;
	overflow: hidden;
	cursor: pointer;
	text-align: center;
	box-shadow: 0 0 15px 5px #242424;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.character img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	border-radius: 10px;
	display: block;
}

#character-grid {
	padding: 1vh 1vh 1vh 1vh;
}

.character:hover {
	transform: scale(1.05);
	box-shadow: 0 0 15px #00aaff;
}

/* Classes sélection joueur 1 et 2 */
.selected-p1 {
	outline: 3px solid #223be0;
}
.selected-p2 {
	outline: 3px solid #c71013;
}
.selected-both {
	outline: 3px solid #ffff00;
}

/* Boutons joueurs actifs */
.inactive {
	opacity: 0.5;
}

/* Pour la grille d'édition */
.editor-character {
position: relative;
padding-bottom: 0.5rem;
height: 60px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}

.editor-character-name {
margin-top: 0.5rem;
font-weight: bold;
font-size: 1rem;
color: #00aaff;
user-select: none;
}

/* Case ajout dans l'éditeur */
.editor-character.add {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 2rem;
color: #00aaff;
border: 2px dashed #00aaff;
cursor: pointer;
}

.editor-form {
display: flex;
gap: 0.5rem;
justify-content: center;
align-items: center;
margin-top: 1rem;
}

.editor-form input[type="text"] {
padding: 0.5rem 1rem;
font-size: 1.2rem;
border-radius: 6px;
border: 1px solid #00aaff;
background: #111;
color: white;
}

.editor-form button {
padding: 0.6rem 1.2rem;
font-size: 1.1rem;
}

/* Bouton télécharger JSON */
#download-btn {
margin-top: 1rem;
padding: 1rem 2rem;
font-size: 1.2rem;
border-radius: 8px;
border: none;
background: #00aaff;
color: white;
cursor: pointer;
display: block;
margin-left: auto;
margin-right: auto;
}

#download-btn:hover {
background: #0077aa;
}

.preview {
	width: auto;
	max-height: 400px;
	height: 50vh;
	aspect-ratio: 3/4;
	background-color: #111;
	border-radius: 10px;
	overflow: hidden;
	display: flex;
	justify-content: center;
	align-items: center;
	flex-shrink: 0;
	flex-grow: 0;
	flex-direction: column;	
}


#preview-p1 {
	background: url(../images/venicafond_L.png);
	background-size: 100%;
	box-shadow: 0 0 15px #223be0;
}

#preview-p2 {
	background: url(../images/venicafond_R.png);
	background-size: 100%;
	box-shadow: 0 0 15px #c71013;
}

.preview-name {
	border-radius: 1%;
	justify-content: center;
	background-color: #111;
	font-size: 3vh;
	text-align: center;
	font-family: "Fighting Spirit TBS";
}

#preview-name-p1,
#preview-name-p2 {
	height: 6vh;
	max-width: 400px;
	width: 50vh;
}

#preview-name-p1 {
	position: absolute;
	top: 100%;
	left: 19vh; /* colle à gauche */
	transform: translateX(-50%) rotate(-90deg);
	transform-origin: left top;
	display: flex;
	justify-content: center;
	align-items: center;
	font-family: "Fighting Spirit TBS";
	background-color: #111;
	box-shadow: 0 0 15px #223be0;
	border-radius: 10px;
	color: white;
}

#preview-name-p2 {
	position: absolute;
	top: 3%;
	right: -31vh; /* colle à droite */
	transform: translateX(50%) rotate(90deg);
	transform-origin: left top;
	display: flex;
	justify-content: center;
	align-items: center;
	font-family: "Fighting Spirit TBS";
	background-color: #111;
	box-shadow: 0 0 15px #c71013;
	border-radius: 10px;
	color: white;
}

.preview img {
display: none;
max-width: 100%;
max-height: 100%;
object-fit: contain !important; /* important pour forcer le bon fit */
border-radius: 10px;
display: block;
}

#preview-img-p2 {
transform: scaleX(-1);
}

#volume-slider {
	display: inline-block;
	width: 80px;
	max-width: 25vw;
	margin: 0;
}

@keyframes pulse-slow {
0%, 100% { transform: scale(1); opacity: 1; }
50% { transform: scale(1.05); opacity: 0.7; }
}

@keyframes pulse-fast {
0%, 100% { transform: scale(1); opacity: 1; }
50% { transform: scale(1.15); opacity: 0.2; }
}

.subtitle.pulse-slow {
animation: pulse-slow 2s infinite;
}

.subtitle.pulse-fast {
animation: pulse-fast 0.2s infinite;
}

.music-trigger {
  position: absolute;
  bottom: 30vh;
  right: 26vw;
  width: 5vw;
  height: 10vh;
  cursor: pointer;
  z-index: 10;
}

@media (min-width: 768px) {
  .players-container {
    flex-direction: row;
    justify-content: space-between;
  }
}

@media (max-width: 768px) {
  #title {
    width: 80vw;
    height: auto;
  }

  .subtitle {
    height: auto;
    width: 40vw;	
  }

  .playerNumber {
    width: 5rem;
    height: auto;
    top: -3rem;
    left: -3rem;
  }

  .preview {
    width: 90vw;
    max-width: 300px;
    aspect-ratio: 3/4;
  }
}

@media (orientation: portrait) {
  .subtitle {
    content: url('../images/Flip Motherfucker.png');
  }
  
	body {
		background: url("../images/Flip MF background.jpg");
		background-size:cover;
		background-position: center center;
	}
}

@media (min-aspect-ratio: 20/9) {

.players-container {
	margin-top: 5vh;
}

.preview {
	height: 17vw;
}

#preview-name-p1,
#preview-name-p2 {
	width: 40vh;
}

.playerNumber {
	width: 12vh;
	height: 15vh;
	top: -7.5vh;
}


#preview-name-p1 {
	left: 14vh; /* colle à gauche */
}

#preview-name-p2 {
	top:5%;
	right: -26vh; /* colle à droite */
}

body {
	background-position: center 50%;
}

.music-trigger {
  bottom: 40vh;
}


}


@media (min-aspect-ratio: 30/9) {

.music-trigger {
  bottom: 50vh;
}


}