/* Guide Chimie Industrielle — design holographique (repris d'INNO-GONAVE) */
:root {
  --bg: #03060a; --cyan: #5ff2e6; --cyan-soft: rgba(95, 242, 230, .35); --line: rgba(95, 242, 230, .18);
  --gold: #ffb648; --text: #d8eef0; --muted: #7d9ca2; --panel: rgba(7, 15, 20, .78);
  --hud: "Orbitron", "Rajdhani", system-ui, sans-serif; --ui: "Rajdhani", "Segoe UI", system-ui, sans-serif;
  --side: 230px; --top: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: radial-gradient(ellipse at 55% 45%, rgba(40, 110, 120, .18), transparent 60%), radial-gradient(ellipse at 85% 90%, rgba(255, 150, 60, .06), transparent 50%), var(--bg);
  color: var(--text); font: 500 15px/1.35 var(--ui); -webkit-tap-highlight-color: transparent;
}
body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 20;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.012) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.6)); }
button { font: inherit; color: inherit; cursor: pointer; }
#cv { position: fixed; inset: 0; touch-action: none; cursor: grab; }
#cv:active { cursor: grabbing; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 10px 40px rgba(0,0,0,.45); }
.chip { border: 1px solid var(--line); background: rgba(7,15,20,.6); border-radius: 999px; padding: 6px 12px; font: 600 9.5px var(--hud); letter-spacing: .1em; color: var(--muted); transition: .15s; white-space: nowrap; }
.chip:hover, .chip.on { color: var(--cyan); border-color: var(--cyan-soft); box-shadow: 0 0 14px rgba(95,242,230,.15); }
.chip.gold, .chip.warn { color: var(--gold); border-color: rgba(255,182,72,.45); }
.chip.icon { font-size: 15px; padding: 3px 11px; }
/* main : bouton visé (aide à la visée) */
.hand-aim { box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(255,182,72,.55) !important; color: var(--gold) !important; border-color: var(--gold) !important; }

/* barre du haut */
#bar { position: fixed; top: 10px; left: 10px; right: 10px; height: 46px; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 0 10px; padding-top: env(safe-area-inset-top); }
#menuBtn { display: none; }
.brand { font: 700 12px var(--hud); letter-spacing: .22em; color: var(--cyan); text-shadow: 0 0 12px var(--cyan-soft); white-space: nowrap; }
.brand span { margin-left: 10px; font-size: 9px; color: var(--muted); letter-spacing: .2em; font-weight: 500; }
#searchForm { position: relative; flex: 1; max-width: 420px; margin-left: auto; }
#q { width: 100%; background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 8px; color: var(--text); font: 500 15px var(--ui); padding: 6px 10px; outline: none; }
#q:focus { border-color: var(--cyan-soft); box-shadow: 0 0 0 3px rgba(95,242,230,.08); }
#sugg { position: absolute; top: 40px; left: 0; right: 0; list-style: none; margin: 0; padding: 6px; max-height: 60vh; overflow-y: auto; z-index: 8; }
#sugg[hidden] { display: none; }
#sugg button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: 0; border-radius: 6px; padding: 6px 8px; }
#sugg button:hover, #sugg button.sel { background: rgba(95,242,230,.1); }
#sugg i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
#sugg small { margin-left: auto; color: var(--muted); font-size: 12px; }
.tools { display: flex; gap: 6px; }

/* catégories */
#side { position: fixed; left: 10px; top: calc(var(--top) + 6px); width: var(--side); max-height: calc(100% - var(--top) - 70px); z-index: 4; display: flex; flex-direction: column; gap: 6px; padding: 10px; overflow-y: auto; scrollbar-width: none; }
#side b { font: 700 9px var(--hud); letter-spacing: .2em; color: var(--gold); margin-top: 4px; }
#side .chip { text-align: left; display: flex; align-items: center; gap: 7px; padding: 6px 10px; font-size: 9px; letter-spacing: .05em; }
#side .chip i { width: 9px; height: 9px; border-radius: 50%; flex: none; box-shadow: 0 0 8px rgba(255,255,255,.4); }
#side .chip small { margin-left: auto; color: var(--muted); font: 600 12px var(--ui); }
#cats { display: flex; flex-direction: column; gap: 4px; }
#side .foot { margin: 6px 2px 0; color: var(--muted); font-size: 12px; }

#hint { position: fixed; right: 10px; bottom: 10px; z-index: 4; font: 600 9.5px var(--hud); letter-spacing: .1em; color: var(--muted); padding: 7px 14px; max-width: calc(100% - 20px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#toast { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 30; font: 600 11px var(--hud); letter-spacing: .2em; color: var(--cyan); opacity: 0; transition: opacity .3s; pointer-events: none; text-shadow: 0 0 10px #000; }
#toast.on { opacity: 1; }
#loading { position: fixed; inset: 0; display: grid; place-items: center; font: 600 12px var(--hud); letter-spacing: .3em; color: var(--cyan); z-index: 25; background: var(--bg); }
#loading[hidden] { display: none; }

/* écran vidéo holographique */
#vidv { position: fixed; inset: 0; z-index: 9; display: grid; place-items: center; padding: 70px 12px 12px; background: rgba(2,5,8,.82); backdrop-filter: blur(4px); perspective: 1400px; }
#vidv[hidden] { display: none; }
#vidv .vframe { position: relative; width: min(1100px, 100%, (100vh - 170px) * 16 / 9); overflow: hidden; transform-origin: 50% 100%;
  background: linear-gradient(160deg, rgba(10,48,60,.85), rgba(3,14,22,.94)); border: 1px solid rgba(95,242,230,.5);
  clip-path: polygon(22px 0, calc(100% - 22px) 0, 100% 22px, 100% calc(100% - 22px), calc(100% - 22px) 100%, 22px 100%, 0 calc(100% - 22px), 0 22px);
  box-shadow: inset 0 0 90px rgba(95,242,230,.14); }
#vidv.on .vframe { animation: holoIn .75s cubic-bezier(.2,.9,.25,1) both; }
#vidv header { position: relative; z-index: 2; display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; padding: 16px 24px 12px; }
#vidv header b { font: 700 12px var(--hud); letter-spacing: .25em; color: var(--cyan); text-shadow: 0 0 10px var(--cyan-soft); }
#vidTitle { flex: 1; min-width: 120px; font: 700 clamp(14px, 1.8vw, 22px) var(--hud); letter-spacing: .06em; color: #e6fdff; text-shadow: 0 0 14px rgba(95,242,230,.7); }
#vidv .vacts { display: flex; gap: 6px; flex-wrap: wrap; }
#vidv .vbox { position: relative; z-index: 2; margin: 0 16px 16px; aspect-ratio: 16 / 9; background: #000; border: 1px solid rgba(95,242,230,.35); box-shadow: 0 0 40px rgba(95,242,230,.18); }
#vidv iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.chip.vid { color: #ff6b6b; border-color: rgba(255,107,107,.5); }
.chip.coal { color: #7dff9b; border-color: rgba(125,255,155,.5); }
.chip.coal:hover { box-shadow: 0 0 14px rgba(125,255,155,.25); }
.chip.food { color: #ffa04d; border-color: rgba(255,160,77,.5); }
.chip.food:hover { box-shadow: 0 0 14px rgba(255,160,77,.25); }
/* fiche « Charbon écologique » */
#holo .lead { font-size: 16px; font-style: italic; color: #e6fdff; }
#holo .tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-top: 10px; }
#holo .tile { padding: 10px 12px; border: 1px solid rgba(125,255,155,.35); background: rgba(125,255,155,.06); border-radius: 4px; animation: hItem .5s both; animation-delay: calc(.3s + var(--i) * 70ms); }
#holo .tile b { display: block; font: 700 18px var(--hud); color: #7dff9b; text-shadow: 0 0 12px rgba(125,255,155,.5); }
#holo .tile span { font-size: 12.5px; color: var(--muted); }
#holo .tags { display: flex; flex-wrap: wrap; gap: 6px; }
#holo .tags span { padding: 5px 10px; border: 1px solid var(--line); background: rgba(95,242,230,.05); border-radius: 4px; font-size: 14px; animation: hItem .5s both; animation-delay: calc(.4s + var(--i) * 40ms); }
#holo .hsec .mt { margin-top: 16px; }
#holo .hsec .sm { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
#holo .hsec .prot { color: var(--gold); }
#holo .steps .sub { margin: 6px 0 2px; padding-left: 18px; }
#holo .steps .sub li { display: list-item; padding: 2px 0; animation: none; font-size: 14px; line-height: 1.4; }
#holo .steps .sub li::marker { content: "▹ "; color: var(--cyan); }
#holo .hsec.credits p { color: var(--muted); font-size: 12px; }
.chip.vid.off { opacity: .4; }

/* caméra (contrôle à la main) */
#cam { position: fixed; right: 10px; bottom: 50px; width: 200px; padding: 6px; z-index: 6; }
#cam[hidden] { display: none; }
.camview { position: relative; border-radius: 8px; overflow: hidden; aspect-ratio: 4 / 3; background: #000; }
.camview video, .camview canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.camview video { opacity: .55; filter: saturate(.4) contrast(1.1); }
#camstate { position: absolute; left: 6px; top: 5px; font: 600 9px var(--hud); letter-spacing: .18em; color: var(--cyan); text-shadow: 0 0 6px #000; }
#hands { position: fixed; inset: 0; pointer-events: none; z-index: 12; }

/* ── écran holographique ── */
#holo[hidden] { display: none; }
#holo { position: fixed; left: calc(var(--side) + 26px); right: 10px; top: calc(var(--top) + 6px); bottom: 48px; perspective: 1400px; z-index: 7; pointer-events: none; }
#holo .hframe {
  pointer-events: auto; position: absolute; inset: 0; display: flex; flex-direction: column; overflow: hidden; transform-origin: 50% 100%;
  background: linear-gradient(160deg, rgba(10,48,60,.82), rgba(3,14,22,.92) 60%, rgba(10,30,48,.86));
  border: 1px solid rgba(95,242,230,.5);
  clip-path: polygon(22px 0, calc(100% - 22px) 0, 100% 22px, 100% calc(100% - 22px), calc(100% - 22px) 100%, 22px 100%, 0 calc(100% - 22px), 0 22px);
  box-shadow: inset 0 0 90px rgba(95,242,230,.14);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transform: rotateX(3deg);
}
#holo .hframe::before {   /* grille holographique */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(95,242,230,.055) 0 1px, transparent 1px 26px), repeating-linear-gradient(90deg, rgba(95,242,230,.055) 0 1px, transparent 1px 26px);
  -webkit-mask-image: radial-gradient(ellipse at 50% 35%, #000 30%, transparent 85%); mask-image: radial-gradient(ellipse at 50% 35%, #000 30%, transparent 85%);
}
#holo .hframe::after {   /* lignes de balayage + scintillement */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 3px);
  animation: hflick 4s steps(1) infinite;
}
@keyframes hflick { 0%, 100% { opacity: 1; } 47% { opacity: .55; } 48% { opacity: 1; } 82% { opacity: .8; } 83% { opacity: 1; } }
.hscan { position: absolute; left: 0; right: 0; height: 140px; top: -140px; pointer-events: none; z-index: 1;
  background: linear-gradient(180deg, transparent, rgba(95,242,230,.08) 70%, rgba(95,242,230,.3) 98%, transparent); animation: hscan 5s linear infinite; }
@keyframes hscan { to { top: 100%; } }
.hc { position: absolute; width: 26px; height: 26px; border: 2px solid var(--cyan); filter: drop-shadow(0 0 6px var(--cyan)); pointer-events: none; z-index: 3; }
.hc.tl { left: 7px; top: 7px; border-right: 0; border-bottom: 0; } .hc.tr { right: 7px; top: 7px; border-left: 0; border-bottom: 0; }
.hc.bl { left: 7px; bottom: 7px; border-right: 0; border-top: 0; } .hc.br { right: 7px; bottom: 7px; border-left: 0; border-top: 0; }
#holo.on .hframe { animation: holoIn .75s cubic-bezier(.2,.9,.25,1) both; }
@keyframes holoIn {
  0% { opacity: 0; transform: rotateX(28deg) scaleY(.02); filter: brightness(3) blur(4px); }
  35% { opacity: 1; transform: rotateX(16deg) scaleY(.06); }
  70% { transform: rotateX(4deg) scaleY(1.02); filter: brightness(1.4) blur(0); }
  100% { transform: rotateX(3deg) scaleY(1); filter: none; }
}
@keyframes spin { to { transform: rotate(360deg); } }
#holo header { position: relative; z-index: 2; display: flex; align-items: center; gap: 16px; padding: 18px 26px 10px; }
#holo .hring { position: relative; width: 74px; height: 74px; flex: none; display: grid; place-items: center; }
#holo .hring svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#holo .hring circle { fill: none; transform-box: fill-box; transform-origin: center; }
#holo .hring .a { stroke: var(--cyan); stroke-width: 1.5; stroke-dasharray: 30 10 4 10; animation: spin 8s linear infinite; }
#holo .hring .b { stroke: var(--gold); stroke-width: 2.5; stroke-dasharray: 50 200; animation: spin 3.5s linear infinite reverse; }
#holo .hring .c { stroke: rgba(95,242,230,.25); stroke-width: 6; }
#hNum { font: 700 17px var(--hud); color: #e6fdff; text-shadow: 0 0 10px var(--cyan); }
#holo .htitle { flex: 1; min-width: 0; }
#hCat { font: 700 10px var(--hud); letter-spacing: .3em; text-transform: uppercase; }
#hTitle { margin: 4px 0 3px; font: 700 clamp(18px, 2.3vw, 30px) var(--hud); letter-spacing: .08em; color: #e6fdff; line-height: 1.1; word-break: break-word;
  text-shadow: 0 0 14px rgba(95,242,230,.8), 0 0 40px rgba(95,242,230,.35); }
#holo.on #hTitle { animation: hglitch .9s steps(2) 1; }
@keyframes hglitch {
  0% { text-shadow: 3px 0 #ff2bd6, -3px 0 #00fff0; transform: translateX(2px); }
  30% { text-shadow: -4px 0 #ff2bd6, 4px 0 #00fff0; transform: translateX(-3px); }
  60% { text-shadow: 2px 0 #ff2bd6, -2px 0 #00fff0; transform: none; }
}
#hMeta { font: 600 9.5px var(--hud); letter-spacing: .16em; color: var(--muted); }
#holo .hacts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 46%; }
#holo .hacts .chip, #hVar .chip { padding: 7px 12px; }
#hVar { position: relative; z-index: 2; display: flex; gap: 6px; flex-wrap: wrap; padding: 0 26px 6px; }
#hVar:empty { display: none; }
#hVar:has(> [data-pr]) { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }   /* 25 recettes : une seule ligne qui défile */
#hVar [data-pr] { flex: none; }
#holo .hbody { position: relative; z-index: 2; flex: 1; overflow-y: auto; padding: 8px 26px 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; align-content: start;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent; overscroll-behavior: contain; }
#holo .hsec { border-top: 1px solid rgba(95,242,230,.25); padding-top: 10px; min-width: 0; }
#holo .hsec.wide { grid-column: 1 / -1; }
#holo .hsec h4 { margin: 0 0 10px; font: 700 10.5px var(--hud); letter-spacing: .25em; color: var(--cyan); text-shadow: 0 0 8px rgba(95,242,230,.6); }
#holo .hsec p { margin: 4px 0; font-size: 14.5px; line-height: 1.45; }
#holo .ing { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
#holo .ing li { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; align-items: center; padding: 6px 10px; background: rgba(95,242,230,.05); border-left: 2px solid rgba(95,242,230,.55);
  animation: hItem .5s both; animation-delay: calc(.35s + var(--i) * 45ms); }
#holo .ing li.grp { display: block; background: none; border: 0; padding: 6px 0 0; font: 700 9.5px var(--hud); letter-spacing: .18em; color: var(--gold); }
#holo .ing .nm { font-size: 14px; line-height: 1.3; }
#holo .ing .role { grid-column: 1 / -1; font-size: 12.5px; line-height: 1.35; color: var(--muted); }
#holo .ing .role b { color: #7cf3ff; font-weight: 600; }
#holo .ref h4 { scroll-margin-top: 10px; }
#holo .ref p { font-size: 14px; }
#holo .ing .q { font: 700 11px var(--hud); color: #03121a; background: var(--cyan); padding: 3px 8px; border-radius: 3px; white-space: nowrap; box-shadow: 0 0 12px rgba(95,242,230,.6); }
#holo .ing .bar { grid-column: 1 / -1; height: 4px; background: rgba(95,242,230,.12); border-radius: 2px; overflow: hidden; }
#holo .ing .bar i { display: block; height: 100%; width: var(--w); background: linear-gradient(90deg, var(--cyan), #fff); box-shadow: 0 0 8px var(--cyan);
  animation: hBar 1.1s both; animation-delay: calc(.5s + var(--i) * 45ms); }
@keyframes hBar { from { width: 0; } }
@keyframes hItem { from { opacity: 0; transform: translateX(-14px); filter: brightness(2.5); } }
#holo .steps { list-style: none; margin: 0; padding: 0; position: relative; }
#holo .steps::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--cyan), rgba(255,182,72,.7)); box-shadow: 0 0 8px var(--cyan); }
#holo .steps li { position: relative; display: flex; gap: 12px; padding: 0 0 12px; animation: hItem .5s both; animation-delay: calc(.4s + var(--i) * 60ms); }
#holo .steps li b { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font: 700 11px var(--hud); color: #03121a; background: var(--cyan); box-shadow: 0 0 14px var(--cyan); position: relative; z-index: 1; }
#holo .steps li span { padding-top: 6px; font-size: 14.5px; line-height: 1.4; }
#holo .hsec.note p { color: #ffe9b0; }
#holo .hsec.warn h4 { color: var(--gold); text-shadow: 0 0 8px rgba(255,182,72,.6); }
#holo .hsec.warn p { color: var(--muted); font-size: 13px; }

/* ── tablettes et téléphones ── */
@media (max-width: 1200px) {   /* barre trop étroite : ces deux boutons restent dans le panneau de gauche */
  .tools .chip.coal, .tools .chip.food { display: none; }
}
@media (max-width: 1000px) {
  #holo .hbody { grid-template-columns: 1fr; }
  #holo .hacts { max-width: none; }
  .brand span { display: none; }
}
@media (max-width: 760px) {
  :root { --side: 260px; }
  #menuBtn { display: block; }
  .brand { display: none; }
  #searchForm { max-width: none; }
  .tools .chip:not(#handsBtn):not(#installBtn):not(#voiceBtn) { display: none; }
  #side { transform: translateX(calc(-100% - 20px)); transition: transform .25s; z-index: 8; }
  body.menu #side { transform: none; }
  #holo { left: 6px; right: 6px; top: calc(var(--top) + 2px); bottom: 6px; }
  #holo header { flex-wrap: wrap; padding: 14px 16px 8px; }
  #holo .hring { width: 54px; height: 54px; }
  #holo .hacts { width: 100%; justify-content: flex-start; }
  #holo .hbody { padding: 6px 16px 20px; }
  #hint { display: none; }
  #cam { width: 130px; bottom: 10px; }
}
