/* ============================================
   jdr-style.css : Forêt pixel + UI tileset
   ============================================ */

:root {
  --or: #c9a227;
  --texte-clair: #f3e6c8;
  --texte-fonce: #2a1a0e;
  --mousse: #d8f0c8;
  --largeur-nav: 220px;
  --largeur-cadre: 640px;
  --bordure-ui: 32px;
}

* { box-sizing: border-box; }

body.page-jdr {
  margin: 0;
  min-height: 100vh;
  font-family: "Courier New", Courier, monospace;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--texte-fonce);
  background: #0a1210;
  /* Pas d’overflow sur body : ça casse position:fixed sur mobile (iOS) */
}

/* ----- Fond / parallax ----- */
.scene-parallax {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background-color: #0a1210;
}

/* Calques desktop (parallax souris), comme avant */
.calque-parallax {
  position: absolute;
  inset: -6%;
  width: 112%;
  height: 112%;
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: cover;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  will-change: transform;
  pointer-events: none;
}

/* Image plate mobile uniquement */
.fond-mobile {
  position: fixed;
  top: 0;
  left: 50%;
  height: 100%;
  width: auto;
  max-width: none;
  transform: translateX(-50%);
  z-index: 0;
  pointer-events: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Radios invisibles */
.radio-vue {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ----- Layout ----- */
.coquille {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 100%;
  overflow-x: hidden;
}

/* ----- Navbar : UI BOX (tileset complet) ----- */
.nav-gauche {
  position: sticky;
  top: 0;
  align-self: flex-start;
  width: var(--largeur-nav);
  min-height: 100vh;
  padding: 1.1rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  color: var(--texte-clair);
  border: var(--bordure-ui) solid transparent;
  border-image: url("ui-menu.png") 32 fill repeat;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.logo-jdr {
  margin: 0 0 0.35rem;
  font-weight: bold;
  color: var(--mousse);
  font-size: 0.85rem;
  line-height: 1.35;
  text-shadow: 1px 1px 0 #000;
}

.centre { text-align: center; }

/* Bouton fixe bottom-right → osnax.html */
.btn-osnax-fixe {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 6.5rem;
  height: 6.5rem;
  padding: 0.5rem;
  text-align: center;
  text-decoration: none;
  font-weight: bold;
  font-size: 0.95rem;
  line-height: 1.25;
  color: #1a1008;
  background: var(--or);
  border: 4px solid #5a3a18;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.45);
  image-rendering: pixelated;
}

.btn-osnax-fixe:hover {
  background: #ffe08a;
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.45);
}

.btn-osnax-inline {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.65rem 1.1rem;
  font-weight: bold;
  text-decoration: none;
  color: #1a1008;
  background: var(--or);
  border: 3px solid #5a3a18;
}

.btn-osnax-inline:hover { background: #ffe08a; }

.liens-vues {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.lien-vue {
  display: block;
  padding: 0.45rem 0.55rem;
  cursor: pointer;
  color: var(--texte-clair);
  border: 1px solid transparent;
  background: rgba(0, 0, 0, 0.25);
  text-shadow: 1px 1px 0 #000;
}

.lien-vue:hover {
  border-color: var(--or);
  color: #fff6c8;
}

#radio-accueil:checked ~ .coquille .lien-accueil,
#radio-univers:checked ~ .coquille .lien-univers,
#radio-comment:checked ~ .coquille .lien-comment,
#radio-des:checked ~ .coquille .lien-des {
  border-color: var(--or);
  color: #fff6c8;
  background: rgba(201, 162, 39, 0.25);
}

.bloc-musique {
  margin-top: auto;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(243, 230, 200, 0.25);
}

.label-musique {
  margin: 0 0 0.35rem;
  color: var(--mousse);
  font-size: 0.9rem;
  text-shadow: 1px 1px 0 #000;
}

.btn-jdr {
  cursor: pointer;
  font: inherit;
  width: 100%;
  padding: 0.4rem 0.5rem;
  color: var(--texte-fonce);
  background: #e8d4a8;
  border: 2px solid #5a3a18;
}

.btn-jdr:hover { background: var(--or); }

.retour-perso {
  display: block;
  margin-top: 0.6rem;
  color: #ffe08a;
  font-size: 0.9rem;
  text-shadow: 1px 1px 0 #000;
}

/* ----- Centre : bandes + encadré INSIDE ----- */
.espace-central {
  flex: 1;
  display: flex;
  align-items: stretch;
  min-width: 0;
  min-height: 100vh;
}

.bande-parallax {
  flex: 1 1 100px;
  min-width: 48px;
}

.cadre-contenu {
  flex: 0 1 var(--largeur-cadre);
  width: 100%;
  max-width: var(--largeur-cadre);
  margin: 1.75rem 0;
  padding: 1.35rem 1.4rem 1.75rem;
  align-self: flex-start;
  color: var(--texte-fonce);
  border: var(--bordure-ui) solid transparent;
  border-image: url("ui-cadre.png") 32 fill repeat;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ----- Vues ----- */
.vue { display: none; }

#radio-accueil:checked ~ .coquille .vue-accueil,
#radio-univers:checked ~ .coquille .vue-univers,
#radio-comment:checked ~ .coquille .vue-comment,
#radio-des:checked ~ .coquille .vue-des {
  display: block;
}

.vue h1 {
  margin-top: 0;
  color: #3d2410;
  font-size: clamp(1.25rem, 3.5vw, 1.75rem);
}

.vue h2 {
  color: #4a2e14;
  font-size: 1.15rem;
}

.sous { color: #5a4028; margin-top: -0.35rem; }

.intro-squelette {
  color: #5a4028;
  font-size: 0.95rem;
}

.placeholder {
  color: #6a5038;
  font-style: italic;
  border-left: 3px solid #8a6840;
  padding-left: 0.75rem;
}

code {
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.08);
  padding: 0.1em 0.35em;
}

/* ----- Dés ----- */
.choix-des {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 1rem;
}

.btn-de {
  cursor: pointer;
  min-width: 3.6rem;
  padding: 0.6rem 0.45rem;
  font: inherit;
  font-weight: bold;
  color: var(--texte-fonce);
  background: #e8d4a8;
  border: 2px solid #5a3a18;
}

.btn-de:hover { background: var(--or); }

.sous-special {
  color: #5a4028;
  font-size: 0.95rem;
  margin: -0.25rem 0 0.75rem;
}

.choix-special {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.btn-special {
  cursor: pointer;
  flex: 1 1 8rem;
  padding: 0.65rem 0.5rem;
  font: inherit;
  font-weight: bold;
  color: #1a1008;
  background: #d4b896;
  border: 2px solid #5a3a18;
}

.btn-special:hover:not(:disabled) { background: var(--or); }

.btn-special:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.case-jet-ecarte {
  opacity: 0.45;
  text-decoration: line-through;
}

.file-des {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 2.4rem;
  margin-bottom: 0.85rem;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.06);
  border: 1px dashed #8a6840;
}

.file-vide {
  color: #6a5038;
  font-style: italic;
  font-size: 0.95rem;
}

.jeton-de {
  cursor: pointer;
  font: inherit;
  font-weight: bold;
  padding: 0.35rem 0.55rem;
  color: var(--texte-fonce);
  background: #ffe8b8;
  border: 2px solid #5a3a18;
}

.jeton-de:hover:not(:disabled) {
  background: #ff6b6b;
  color: #fff;
}

.jeton-de:disabled {
  opacity: 0.7;
  cursor: default;
}

.actions-des {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.btn-lancer {
  cursor: pointer;
  font: inherit;
  font-weight: bold;
  padding: 0.65rem 1.2rem;
  color: #1a1008;
  background: var(--or);
  border: 2px solid #5a3a18;
}

.btn-lancer:hover:not(:disabled) { background: #e8c84a; }

.btn-vider {
  cursor: pointer;
  font: inherit;
  padding: 0.65rem 0.9rem;
  color: var(--texte-fonce);
  background: #e8d4a8;
  border: 2px solid #5a3a18;
}

.btn-lancer:disabled,
.btn-vider:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.zone-jets {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3.5rem;
  margin-bottom: 0.5rem;
}

.case-jet {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 3.2rem;
  padding: 0.35rem 0.45rem;
  background: rgba(0, 0, 0, 0.06);
  border: 2px solid #5a3a18;
}

.case-jet-label {
  font-size: 0.75rem;
  color: #5a4028;
}

.case-jet-valeur {
  font-size: 1.6rem;
  font-weight: bold;
  color: #7a4010;
  min-height: 1.6em;
}

.case-jet-valeur.en-train-de-lancer {
  animation: secoue 0.12s ease-in-out infinite;
}

.case-jet-valeur.jet-termine {
  color: #2a6b2a;
}

.resultat-de {
  font-size: clamp(2.2rem, 8vw, 3.5rem);
  text-align: center;
  color: #7a4010;
  min-height: 3.5rem;
  font-weight: bold;
}

@keyframes secoue {
  0%, 100% { transform: translateX(0) rotate(-3deg); }
  50% { transform: translateX(4px) rotate(3deg); }
}

.detail-jet {
  text-align: center;
  color: #5a4028;
  min-height: 1.4em;
  word-break: break-word;
}

.historique-des {
  list-style: none;
  padding: 0;
  margin: 0;
  color: #4a3420;
}

.historique-des li {
  padding: 0.25rem 0;
  border-bottom: 1px dotted #8a6840;
}

@media (max-width: 700px) {
  body.page-jdr { font-size: 0.95rem; }

  .coquille { flex-direction: column; }

  .nav-gauche {
    position: relative;
    width: 100%;
    min-height: auto;
    border-width: 16px;
    border-image-width: 16px;
    padding: 0.75rem 0.65rem;
  }

  .logo-jdr { font-size: 0.95rem; }

  .liens-vues {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .lien-vue {
    flex: 1 1 40%;
    text-align: center;
    padding: 0.65rem 0.4rem;
    font-size: 0.9rem;
  }

  .bloc-musique { margin-top: 0.5rem; }

  .btn-jdr {
    min-height: 2.6rem;
    font-size: 1rem;
  }

  .espace-central {
    flex-direction: column;
    min-height: auto;
    padding-bottom: 5.5rem; /* place pour le bouton Osnax */
  }

  .bande-parallax { display: none; }

  .cadre-contenu {
    max-width: none;
    margin: 0.6rem;
    flex: 1 1 auto;
    border-width: 16px;
    border-image-width: 16px;
    padding: 1rem 0.9rem 1.25rem;
  }

  .btn-osnax-fixe {
    right: 0.75rem;
    bottom: 0.75rem;
    width: 4.8rem;
    height: 4.8rem;
    font-size: 0.8rem;
  }

  .btn-de,
  .btn-lancer,
  .btn-vider {
    min-height: 2.6rem;
    padding: 0.7rem 0.75rem;
  }

  .choix-des .btn-de {
    flex: 1 1 28%;
  }
}

body.mode-mobile .scene-parallax {
  display: none; /* remplacé par <img class="fond-mobile"> */
}

@media (prefers-reduced-motion: reduce) {
  .case-jet-valeur.en-train-de-lancer { animation: none; }
}
