@import 'https://fonts.googleapis.com/css?family=Titillium+Web:700';

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
}

body {
  min-height: 100vh;
  background: black;
}

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;
  inset: 0;
  width: 100vw;
  height: 100vh;
  box-sizing: border-box;
  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 120px 20px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.modal-dice.active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.blackhole-viz {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

.blackhole-viz canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.modal-dice .dice-modal-content,
.result-wrapper,
#zone-lancers,
.btn-wrapper,
#history-container {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.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: rgba(0, 255, 214, 0.7);
  cursor: pointer;
  z-index: 3;
}

.dice-center-display {
  position: relative;
  width: 300px;
  height: 300px;
}

.dice-result-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#dice-result {
  font-family: 'Oxanium', sans-serif;
  font-size: 68px;
  font-weight: bold;
  line-height: 1;
  color: white;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.08);
  user-select: none;
}

.dice-modal-content.rolling #dice-result {
  opacity: 1;
}

.result-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 20px auto;
  max-width: 90%;
  flex-wrap: wrap;
}

.result-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

#affichage-result {
  font-family: 'Oxanium', sans-serif;
  color: white;
  font-size: 16px;
  background:
    linear-gradient(180deg, rgba(90, 220, 255, 0.09), rgba(90, 220, 255, 0.03)),
    rgba(10, 14, 20, 0.78);
  border: 1px solid rgba(90, 220, 255, 0.2);
  box-shadow:
    inset 0 0 14px rgba(90, 220, 255, 0.05),
    0 0 16px rgba(0, 0, 0, 0.28);
  padding: 10px 20px;
  border-radius: 10px;
  max-width: 90%;
  max-height: 120px;
  overflow-y: auto;
  text-align: center;
  word-break: break-word;
  scrollbar-width: thin;
  backdrop-filter: blur(6px);
}

#affichage-result::-webkit-scrollbar {
  width: 6px;
}

#affichage-result::-webkit-scrollbar-thumb {
  background: rgba(90, 220, 255, 0.5);
  border-radius: 3px;
}

#crit-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Oxanium', sans-serif;
  font-weight: bold;
  color: orange;
  font-size: 14px;
  margin-left: 5px;
  cursor: pointer;
  user-select: none;
}

#crit-toggle {
  accent-color: orange;
  width: 24px;
  height: 24px;
  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: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.container-dice p {
  color: rgba(0, 255, 214, 0.7);
  font-family: 'Oxanium', sans-serif;
  font-weight: bold;
  margin: 0 2px;
  font-size: 20px;
  text-shadow: 0 0 8px rgba(255, 165, 0, 0.28);
}

.interligne-op {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

.btn-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin: 20px auto;
  flex-wrap: wrap;
  position: relative;
  z-index: 3;
}

#history-container {
  width: 90%;
  max-width: 300px;
  height: 240px;
  margin: 10px auto 40px auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)),
    rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  overflow: hidden;
  color: white;
  font-family: 'Oxanium', sans-serif;
  position: relative;
  z-index: 3;
  flex-shrink: 0;
  backdrop-filter: blur(4px);
}

#history-container h3 {
  margin: 8px 0;
  text-align: center;
  font-size: 14px;
  font-weight: bold;
}

#history-rolls {
  height: calc(100% - 32px);
  list-style: none;
  padding: 0 8px;
  margin: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

#history-rolls .history-item {
  margin-bottom: 4px;
  word-break: break-word;
  white-space: normal;
}

.fav-item {
  display: flex;
  gap: 10px;
  align-items: center;
}

#favorites-toggle {
  display: none;
  position: fixed;
  top: 50vh;
  right: 0;
  transform: translateY(-50%);
  z-index: 10002;
}

#favorites-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: calc(100vw - 40px);
  max-width: 500px;
  height: 100vh;
  background: rgba(0, 0, 0, 0.95);
  color: white;
  font-family: 'Oxanium', sans-serif;
  padding: 20px;
  box-sizing: border-box;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 10001;
  overflow-y: auto;
  backdrop-filter: blur(8px);
}

#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;
}

.home-hero {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background: black;
}

.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("../img/crousti_dice.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(18px) brightness(0.35);
  transform: scale(1.08);
  z-index: 0;
}

.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  z-index: 1;
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0%,
    rgba(0, 0, 0, 0.35) 8%,
    black 18%,
    black 82%,
    rgba(0, 0, 0, 0.35) 92%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0%,
    rgba(0, 0, 0, 0.35) 8%,
    black 18%,
    black 82%,
    rgba(0, 0, 0, 0.35) 92%,
    transparent 100%
  );
}

.hotspot-dice {
  position: absolute;
  z-index: 5;
  display: block;
  cursor: pointer;
}



/* =========================================================
   SKIN UI SCI-FI
   Boutons / Inputs / Selects
   Palette bleu / cyan / turquoise
   ========================================================= */

.container-dice input[type="number"],
.container-dice select {
  appearance: none;
  -webkit-appearance: none;
  text-align: center;
  height: 42px;
  min-width: 58px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(90, 220, 255, 0.22);
  background:
    linear-gradient(180deg, rgba(90, 220, 255, 0.09), rgba(90, 220, 255, 0.02)),
    rgba(8, 12, 18, 0.84);
  color: #eafcff;
  font-family: 'Oxanium', sans-serif;
  font-size: 15px;
  box-shadow:
    inset 0 0 10px rgba(90, 220, 255, 0.04),
    0 0 12px rgba(0, 0, 0, 0.24);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
  backdrop-filter: blur(4px);
}

.container-dice input[type="number"]:hover,
.container-dice select:hover {
  border-color: rgba(90, 220, 255, 0.42);
  box-shadow:
    inset 0 0 12px rgba(90, 220, 255, 0.08),
    0 0 14px rgba(90, 220, 255, 0.1);
}

.container-dice input[type="number"]:focus,
.container-dice select:focus {
  outline: none;
  border-color: rgba(0, 255, 214, 0.62);
  box-shadow:
    inset 0 0 12px rgba(0, 255, 214, 0.08),
    0 0 0 1px rgba(0, 255, 214, 0.2),
    0 0 16px rgba(0, 255, 214, 0.18);
  transform: translateY(-1px);
}

.container-dice input[type="number"]::placeholder {
  color: rgba(220, 245, 255, 0.34);
}

.container-dice button,
.interligne-op .inter-op,
#ajouter-ligne,
.lancer-des,
.reset-btn,
.fav-roll-btn,
.fav-remove-btn,
#favorites-toggle,
#save-favorite {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(90, 220, 255, 0.2);
  background:
    linear-gradient(180deg, rgba(90, 220, 255, 0.12), rgba(90, 220, 255, 0.03)),
    rgba(10, 14, 20, 0.84);
  color: #eafcff;
  font-family: 'Oxanium', sans-serif;
  box-shadow:
    inset 0 0 10px rgba(90, 220, 255, 0.05),
    0 0 14px rgba(0, 0, 0, 0.24);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
  backdrop-filter: blur(4px);
}

.container-dice button:hover,
.interligne-op .inter-op:hover,
#ajouter-ligne:hover,
.lancer-des:hover,
.reset-btn:hover,
.fav-roll-btn:hover,
.fav-remove-btn:hover,
#favorites-toggle:hover,
#save-favorite:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 255, 214, 0.45);
  box-shadow:
    inset 0 0 12px rgba(0, 255, 214, 0.05),
    0 0 0 1px rgba(0, 255, 214, 0.14),
    0 0 16px rgba(0, 255, 214, 0.16);
}

.container-dice button:active,
.interligne-op .inter-op:active,
#ajouter-ligne:active,
.lancer-des:active,
.reset-btn:active,
.fav-roll-btn:active,
.fav-remove-btn:active,
#favorites-toggle:active,
#save-favorite:active {
  transform: translateY(0);
}

/* Boutons +/- d'une ligne */
.container-dice button {
  width: 36px;
  height: 42px;
  padding: 0;
  border-radius: 10px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
}

/* Etat normal discret */
.container-dice button.operation {
  border-color: rgba(90, 220, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(90, 220, 255, 0.05), rgba(90, 220, 255, 0.015)),
    rgba(8, 12, 18, 0.72);
  color: rgba(210, 242, 255, 0.82);
  box-shadow:
    inset 0 0 8px rgba(90, 220, 255, 0.02),
    0 0 10px rgba(0, 0, 0, 0.18);
}

/* Etat sélectionné très lisible */
.container-dice button.operation.selected {
  border-color: rgba(0, 255, 214, 0.7);
  background:
    linear-gradient(180deg, rgba(0, 255, 214, 0.22), rgba(0, 255, 214, 0.08)),
    rgba(8, 18, 20, 0.92);
  color: #dffffb;
  box-shadow:
    inset 0 0 12px rgba(0, 255, 214, 0.14),
    0 0 0 1px rgba(0, 255, 214, 0.16),
    0 0 16px rgba(0, 255, 214, 0.18),
    0 0 28px rgba(0, 255, 214, 0.1);
}

/* Hover sur un bouton non sélectionné */
.container-dice button.operation:not(.selected):hover {
  border-color: rgba(90, 220, 255, 0.34);
  color: #f0fcff;
}

/* Boutons +/- entre les lignes */
.interligne-op .inter-op {
  width: 46px;
  height: 42px;
  padding: 0;
  border-radius: 10px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  border-color: rgba(90, 220, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(90, 220, 255, 0.05), rgba(90, 220, 255, 0.015)),
    rgba(8, 12, 18, 0.72);
  color: rgba(210, 242, 255, 0.82);
  box-shadow:
    inset 0 0 8px rgba(90, 220, 255, 0.02),
    0 0 10px rgba(0, 0, 0, 0.18);
}

.interligne-op .inter-op.selected {
  border-color: rgba(0, 255, 214, 0.7);
  background:
    linear-gradient(180deg, rgba(0, 255, 214, 0.22), rgba(0, 255, 214, 0.08)),
    rgba(8, 18, 20, 0.92);
  color: #dffffb;
  box-shadow:
    inset 0 0 12px rgba(0, 255, 214, 0.14),
    0 0 0 1px rgba(0, 255, 214, 0.16),
    0 0 16px rgba(0, 255, 214, 0.18),
    0 0 28px rgba(0, 255, 214, 0.1);
}

.interligne-op .inter-op:not(.selected):hover {
  border-color: rgba(90, 220, 255, 0.34);
  color: #f0fcff;
}

/* Suppression / danger */
.container-dice .supprimer-ligne,
.fav-remove-btn {
  border-color: rgba(255, 90, 140, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 90, 140, 0.14), rgba(255, 90, 140, 0.04)),
    rgba(16, 8, 14, 0.84);
  color: #ffc4dc;
}

.container-dice .supprimer-ligne:hover,
.fav-remove-btn:hover {
  border-color: rgba(255, 90, 140, 0.48);
  box-shadow:
    inset 0 0 12px rgba(255, 90, 140, 0.05),
    0 0 0 1px rgba(255, 90, 140, 0.14),
    0 0 16px rgba(255, 90, 140, 0.14);
}

/* Boutons principaux */
#ajouter-ligne,
.lancer-des,
.fav-roll-btn,
.reset-btn {
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

#ajouter-ligne {
  color: #b9ecff;
}

.lancer-des,
.fav-roll-btn {
  color: #b8fff6;
  border-color: rgba(0, 255, 214, 0.26);
  background:
    linear-gradient(180deg, rgba(0, 255, 214, 0.14), rgba(0, 255, 214, 0.04)),
    rgba(8, 14, 16, 0.86);
}

.lancer-des:hover,
.fav-roll-btn:hover {
  box-shadow:
    inset 0 0 12px rgba(0, 255, 214, 0.06),
    0 0 0 1px rgba(0, 255, 214, 0.16),
    0 0 18px rgba(0, 255, 214, 0.18);
}

.reset-btn {
  color: #b9ecff;
  padding-inline: 12px;
}

#save-favorite,
#favorites-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(90, 220, 255, 0.08), rgba(90, 220, 255, 0.02)),
    rgba(8, 12, 18, 0.84);
  border-radius: 12px;
  padding: 8px;
  cursor: pointer;
}

#save-favorite {
  margin-left: 8px;
}

#save-favorite img,
.etoile {
  width: 30px;
}

.fav-remove-btn {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  font-size: 18px;
  padding: 0;
}

@media screen and (min-width: 340px) {
  .container-dice input[type="number"],
  .container-dice select {
    min-width: 68px;
  }
}

@media screen and (max-width: 480px) {
  .btn-wrapper {
    gap: 12px;
  }

  #ajouter-ligne,
  .lancer-des,
  .fav-roll-btn,
  .reset-btn {
    font-size: 13px;
    padding: 10px 12px;
  }
}


#favorites-toggle {
  transform: translateY(-50%);
}

#favorites-toggle:hover {
  transform: translateY(-50%);
  border-color: rgba(0, 255, 214, 0.45);
  box-shadow:
    inset 0 0 12px rgba(0, 255, 214, 0.05),
    0 0 0 1px rgba(0, 255, 214, 0.14),
    0 0 16px rgba(0, 255, 214, 0.16),
    0 0 28px rgba(90, 220, 255, 0.12);
}