@import 'https://fonts.googleapis.com/css?family=Titillium+Web:700';

body.no-scroll {
  overflow: hidden;
}

@keyframes fadeInZoom {
  0% { opacity: 0; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes fadeOutZoom {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.8); }
}

.modal-dice {
  display: none;
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  width: 100vw;
  /* passe de min-height à height et active box‑sizing */
  box-sizing: border-box;   /* inclut le padding dans la hauteur */
  height: 100vh;            /* exactement la taille de la fenêtre */
  background-color: rgba(0, 0, 0, 0.95);
  justify-content: flex-start;
  align-items: center;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 40px 20px;
  overflow-y: auto;         /* scroll vertical sur tout le contenu */
  overflow-x: hidden;
}

.modal-dice.active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.modal-dice .dice-modal-content {
  position: relative;
  width: 300px;
  height: 300px;
  margin-bottom: 40px;
  animation: fadeInZoom 0.3s ease forwards;
}

.modal-dice.closing .dice-modal-content {
  animation: fadeOutZoom 0.2s ease forwards;
}

.close-modal {
  position: absolute;
  top: -30px;
  right: calc(-50vw + 150px + 20px);
  background: transparent;
  border: none;
  font-size: 40px;
  color: orange;
  cursor: pointer;
}

.dice-svg-container {
  width: 100%;
  height: 100%;
}

svg#gits {
  display: block;
  width: 100%;
  height: 100%;
}

svg#gits circle {
  stroke: orange;
  fill: none;
  stroke-width: 3px;
  transition: 0.2s;
  stroke-dasharray: 0 600;
  opacity: 0.9;
}

svg#gits text {
  font-family: 'Titillium Web', sans-serif;
  font-size: 20px;
  text-anchor: middle;
  font-weight: bold;
  user-select: none;
}

/* WRAPPER du résultat + reset */
.result-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 20px auto;
  max-width: 90%;
  flex-wrap: wrap;
}

#affichage-result {
  font-family: 'Titillium Web', sans-serif;
  color: white;
  font-size: 16px;
  background: rgba(255, 165, 0, 0.1);
  padding: 10px 20px;
  border-radius: 8px;
  max-width: 90%;
  max-height: 120px;
  overflow-y: auto;
  text-align: center;
  word-break: break-word;
  scrollbar-width: thin;  
}

#affichage-result::-webkit-scrollbar {
  width: 6px;  /* Chrome, Safari, Edge */
}

#affichage-result::-webkit-scrollbar-thumb {
  background: rgba(255,165,0,0.5);
  border-radius: 3px;
}

.reset-btn {
  background-color: #444;
  color: orange;
  border: none;
  padding: 8px 10px;
  border-radius: 4px;
  font-weight: bold;
  font-size: 18px;
  cursor: pointer;
}

#zone-lancers {
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  align-items: center;
}

.container-dice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
  width: 100%;
}

.container-dice input[type="number"],
.container-dice select {
  text-align: center;
  height: 30px;
  width: 48px;
  padding: 4px;
  border-radius: 4px;
  border: 1px solid #ccc;
}

.container-dice p {
  color: orange;
  font-weight: bold;
  margin: 0 5px;
  font-size: 20px;
}

.container-dice button {
  padding: 4px 8px;
  font-size: 14px;
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
  border: none;
  width: 25px;
}

.container-dice button.operation {
  background-color: #ffa500;
  color: black;
}

.container-dice button.operation.selected {
  background-color: #ffa500;
  color: black;
}

.container-dice .supprimer-ligne {
  background-color: #ff4444;
  color: white;
  font-size: 14px;
}

.interligne-op {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

.interligne-op .inter-op {
  background-color: #ffa500;
  color: black;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
  width: 35px;
}

.interligne-op .inter-op.selected {
  background-color: #ffa500;
  color: black;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
}

#ajouter-ligne,
.lancer-des {
  display: block;
  margin: 10px auto;
  padding: 10px 6px;
  border-radius: 6px;
  font-weight: bold;
  border: none;
  cursor: pointer;
}

#ajouter-ligne {
  background-color: orange;
  color: black;
}

.lancer-des {
  background-color: #00ffcc;
  color: black;
  font-size: 15px;
}

#crit-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: 'Titillium Web', sans-serif;
  font-weight: bold;
  color: orange;
  font-size: 14px;
  margin-left: 5px;
  cursor: pointer;
  user-select: none;
}

#crit-toggle {
  accent-color: orange;
  width: 30px;
  height: 30px;
  cursor: pointer;
}

.result-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin: 20px auto;
  flex-wrap: wrap;
}

#ajouter-ligne,
.lancer-des {
  margin: 0; /* on supprime les marges verticales */
}





/* === HISTORIQUE DES LANCERS (fixe largeur & hauteur, scroll vertical) === */
#history-container {
  width: 90%;
  max-width: 300px;
  height: 240px;        /* fixe hauteur */
  margin: 10px auto;
  background: rgba(0,0,0,0.2);
  border-radius: 6px;
  overflow: hidden;     /* masque tout débordement */
  color: white;
  font-family: 'Titillium Web', sans-serif;
}

#history-container h3 {
  margin: 8px 0;
  text-align: center;
  font-size: 14px;
  font-weight: bold;
}

#history-rolls {
  height: calc(100% - 32px);  /* prend toute la hauteur dispo sous le titre */
  list-style: none;
  padding: 0 8px;
  margin: 0;
  overflow-y: auto;    /* scroll vertical */
  overflow-x: hidden;  /* interdit horizontal scroll */
}

#history-rolls .history-item {
  margin-bottom: 4px;
  word-break: break-word;  /* coupe les très longues chaînes */
  white-space: normal;
}


/* Favoris */
.fav-item{
  display: flex;
  gap: 10px;
  align-items: center;
}

.fav-remove-btn{
  background: transparent;
  border: none;
  font-size: 20px;
  color: #FFA500;
  cursor: pointer;
}

.fav-roll-btn{
  background: #FFA500;
  border: none;
  font-size: 15px;
  color: black;
  cursor: pointer;
  border-radius: 6px;
  padding: 8px 8px;
  font-weight: bold;
}

/* Bouton toggle */
#favorites-toggle {
  display: none;
  position: fixed;
  top: 50vh;
  right: 0;
  transform: translateY(-50%);
  z-index: 10002;
  background-color: white;
  border: none;
  padding: 8px;
  border-radius: 8px 0 0 8px;
  cursor: pointer;
}

/* Panneau caché à gauche */
#favorites-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: calc(100vw - 40px);
  max-width: 767px;
  height: 100vh;
  background: rgba(0,0,0,0.95);
  color: white;
  font-family: 'Titillium Web', sans-serif;
  padding: 20px;
  box-sizing: border-box;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 10001;
  overflow-y: auto;
}

#favorites-panel.open {
  transform: translateX(0);
}

#favorites-panel h3 {
  margin-top: 0;
  font-size: 18px;
  text-align: center;
}

#favorites-rolls {
  list-style: none;
  padding: 0;
  margin: 0;
}

#favorites-rolls li {
  margin-bottom: 10px;
  cursor: pointer;
}

/* Bouton “Ajouter aux favoris” */
#save-favorite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: black;
  color: #000;
  border: none;
  border-radius: 6px;
  padding: 4px 4px;
  font-size: 18px;
  line-height: 1;
  margin-left: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

#save-favorite img,
.etoile {
  width: 30px;
}

@media screen and (min-width: 340px) {
  .container-dice input[type="number"],
  .container-dice select {
    width: 60px;
  }

}

@media screen and (min-width: 390px) {
  /* Aligne verticalement toutes les lignes de lancer sauf la première */
  #zone-lancers > section.container-dice:not(:first-of-type) {
    padding-left: 38px;
  }
}

@media screen and (min-width: 449px) {
  #favorites-panel {
    max-width: 50vw;
  }
}