/* ==========================================================================
   Nuit de l’horreur — feuille de style
   Organisation : variables · base · écrans (menu, boutique, histoire) · HUD ·
   boutons tactiles · dialogues · réglages
   ========================================================================== */

:root {
  --bg: #07040d;
  --bone: #f1e4c8;
  --or: #ff7a1a;
  --rd: #d81f2a;
  --s: clamp(44px,16vh,84px);
  --L: clamp(60px,24vh,120px);
  --g: 2.5vh;
}

* {
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--bone);
  font-family: Georgia,'Times New Roman',serif;
  overflow: hidden;
  touch-action: none;
}

canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.ov {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  text-align: center;
  background: rgba(7,4,13,.88);
  z-index: 5;
  padding: 38px 24px 14px;
}

h1 {
  margin: 0 0 6px;
  font-size: clamp(20px,7vh,44px);
  color: var(--or);
  text-shadow: 0 0 22px var(--rd);
}

p {
  margin: 4px 0;
  font-size: clamp(10px,2.8vh,14px);
  max-width: 700px;
  line-height: 1.4;
}

button {
  font: inherit;
  background: var(--or);
  color: #1a0900;
  border: 0;
  border-radius: 10px;
  padding: 10px 30px;
  font-size: clamp(15px,5vh,22px);
  margin-top: 10px;
  font-weight: 700;
}

#rot {
  display: none;
  z-index: 9;
  background: var(--bg);
}

@media (orientation:portrait) {
  #rot {
    display: flex;
  }

}

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  padding: env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);
}

#hp {
  position: absolute;
  left: 14px;
  top: 10px;
  width: 30vw;
  max-width: 220px;
  height: 12px;
  border: 1px solid #fff6;
  background: #0008;
}

#hp i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--rd);
}

#info {
  position: absolute;
  right: 14px;
  top: 6px;
  text-shadow: 0 0 6px #000;
  font-size: 14px;
}

#wp {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  color: var(--or);
  text-shadow: 0 0 6px #000;
  font-size: 15px;
  white-space: nowrap;
}

#cx {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
}

#cx i, #cx b, #cx u {
  position: absolute;
  box-shadow: 0 0 3px #000;
}

#cx b {
  border-radius: 50%;
}

#cx u {
  border: 2px solid #fff;
  border-radius: 50%;
  text-decoration: none;
}

#ts {
  position: absolute;
  left: 50%;
  bottom: 46px;
  transform: translateX(-50%);
  color: #ffdd88;
  text-shadow: 0 0 6px #000;
  opacity: 0;
  transition: opacity .3s;
  font-size: 15px;
  white-space: nowrap;
}

#bn {
  position: absolute;
  left: 0;
  right: 0;
  top: 20%;
  text-align: center;
  font-size: 8vh;
  color: var(--or);
  text-shadow: 0 0 20px var(--rd);
  opacity: 0;
  transition: opacity .5s;
}

#dm {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 90px 30px #f00;
  opacity: 0;
  transition: opacity .3s;
}

.b {
  display: none;
  position: fixed;
  z-index: 3;
  border-radius: 50%;
  background: #ff7a1a55;
  border: 2px solid var(--or);
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: clamp(9px,calc(var(--s)*.2),14px);
}

#f {
  right: calc(env(safe-area-inset-right,0px) + var(--g));
  bottom: var(--g);
  width: var(--L);
  height: var(--L);
}

#w {
  right: calc(env(safe-area-inset-right,0px) + var(--g));
  bottom: calc(var(--g)*2 + var(--L));
  width: var(--s);
  height: var(--s);
}

#r {
  right: calc(env(safe-area-inset-right,0px) + var(--g)*2 + var(--L));
  bottom: var(--g);
  width: var(--s);
  height: var(--s);
}

#a {
  right: calc(env(safe-area-inset-right,0px) + var(--g)*2 + var(--L));
  bottom: calc(var(--g)*2 + var(--s));
  width: var(--s);
  height: var(--s);
}

#p {
  right: calc(env(safe-area-inset-right,0px) + var(--g)*3 + var(--L) + var(--s));
  bottom: var(--g);
  width: var(--s);
  height: var(--s);
}

#shop, #sty {
  z-index: 6;
}

#shop h1 {
  font-size: clamp(18px,6vh,28px);
}

#sl {
  overflow: auto;
  width: min(760px,100%);
  max-height: 60vh;
  text-align: left;
}

.it {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-bottom: 1px solid #fff2;
  font-size: clamp(11px,3.3vh,14px);
}

.it b {
  flex: 1;
}

.it small {
  opacity: .7;
}

.it button {
  margin: 0;
  padding: 5px 12px;
  font-size: inherit;
}

button:disabled {
  opacity: .4;
}

#go {
  position: sticky;
  bottom: 8px;
  box-shadow: 0 0 16px #000;
}

.ov>:first-child {
  margin-top: auto;
}

.ov>:last-child {
  margin-bottom: auto;
}

h3 {
  margin: 8px 0 2px;
  color: var(--or);
  font-size: 15px;
}

@media (hover:none) {
  .b {
    display: flex;
  }

  #tg {
    display: block;
  }

}

body.nt .b {
  display: none!important;
}

#gb {
  position: fixed;
  top: 6px;
  left: 50%;
  margin-left: 62px;
  z-index: 8;
  padding: 3px 9px;
  font-size: 13px;
  border-radius: 12px;
  background: #000a;
  color: var(--bone);
  border: 1px solid #fff4;
  cursor: pointer;
}

#cf {
  z-index: 7;
  padding-top: 36px;
}

#cf .it {
  width: 100%;
}

#cf input[type=range] {
  flex: 1;
  max-width: 200px;
}

#dl {
  position: fixed;
  left: 3%;
  right: 3%;
  bottom: 10px;
  z-index: 7;
  background: #f8f4e8;
  color: #1a1a2e;
  border: 4px solid #1a1a2e;
  outline: 3px solid #f8f4e8;
  border-radius: 6px;
  padding: 10px 16px 14px;
  min-height: 30vh;
  font-family: 'Courier New',monospace;
  font-size: clamp(13px,4.2vh,19px);
  line-height: 1.4;
}

#dp {
  float: left;
  font-size: 9vh;
  line-height: 1;
  margin: 0 14px 0 0;
}

#dn {
  font-weight: 700;
  color: #b04a00;
  margin-bottom: 4px;
}

#dk {
  position: absolute;
  right: 16px;
  bottom: 8px;
  animation: bl 1s steps(2) infinite;
}

@keyframes bl {
  50% {
    opacity: 0;
  }

}

#bb {
  position: absolute;
  left: 50%;
  top: 34px;
  transform: translateX(-50%);
  width: min(60vw,420px);
  border: 1px solid #fff6;
  background: #000a;
  padding: 2px;
}

#bbn {
  font-size: 12px;
  text-align: center;
  color: #ffd8a0;
}

#bb i {
  display: block;
  height: 9px;
  background: #c0202a;
  width: 100%;
}

#ds {
  position: absolute;
  right: 10px;
  top: 6px;
  margin: 0;
  padding: 2px 8px;
  font-size: 12px;
  background: #ddd;
  color: #222;
  border: 2px solid #222;
  border-radius: 4px;
}

#tg {
  display: none;
  position: fixed;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  padding: 3px 12px;
  font-size: 12px;
  border-radius: 12px;
  background: #000a;
  color: var(--bone);
  border: 1px solid #fff4;
}
