/* Hector — interface du jeu (par-dessus la scène 3D). Repris de Myrmidon (combat.html), avec la jauge de Troie,
   les cartes des brèches, le kléos et son médaillon de série, le répit et le flash d'impact. */
@font-face { font-family: "Lilita One"; src: url("fonts/lilita-one.woff2") format("woff2"); font-display: swap; }
:root { --texte: #f1e3c6; --accent: #e0a050; --rouge: #d0553a; --or: #ffd27a; }
html, body { margin: 0; height: 100%; background: #2a1e14; color: var(--texte); font: 15px system-ui, sans-serif; overflow: hidden; }
*, *::before, *::after { touch-action: manipulation; -webkit-tap-highlight-color: transparent; box-sizing: border-box; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
canvas { touch-action: none; }
#scene { position: absolute; inset: 0; }
/* vignettage : les bords s'assombrissent, le regard reste au centre */
#scene::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 55%, #1a0e0688 100%); }
#flash { position: fixed; inset: 0; pointer-events: none; z-index: 6; background: #fff4dc; opacity: 0; mix-blend-mode: screen; }

/* ---------- jauges ---------- */
.barre { position: absolute; height: 10px; background: #0009; border: 1px solid #0008; }
.barre > div { height: 100%; background: var(--rouge); transition: width .15s; }
#hud { position: absolute; left: 24px; bottom: 22px; width: 280px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.jauge { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px; text-shadow: 0 1px 3px #000; }
.jauge i { font-style: normal; font-size: 20px; text-align: center; }
.jauge .fond { height: 12px; background: #000a; border: 1px solid #0008; border-radius: 3px; overflow: hidden; position: relative; }
.jauge .fond > div { height: 100%; transition: width .2s, background .3s; }
.jauge b { font: 700 15px system-ui; min-width: 44px; text-align: right; }
.jauge small { position: absolute; left: 34px; top: -15px; font-size: 11px; color: #cbbd9f; letter-spacing: .04em; }
#jVie, #jTroie { position: relative; }
#jVie .fond > div { background: linear-gradient(#e6c06a, #b8862e); }
#jTroie .fond > div { background: #5fbf5a; }
#jTroie.orange .fond > div { background: #e0a050; } #jTroie.rouge .fond > div { background: #d0332a; }
#jTroie.rouge .fond { animation: critique .45s ease-in-out infinite alternate; }
@keyframes critique { to { box-shadow: 0 0 0 2px #ff3a1a, 0 0 12px #ff3a1a; } }

/* ---------- les brèches : une carte par brèche, en haut au milieu ; la toucher = y courir ---------- */
#breches { position: absolute; left: 50%; top: calc(12px + env(safe-area-inset-top)); translate: -50% 0; display: flex; gap: 12px; }
.breche { width: 158px; padding: 7px 9px 8px; border-radius: 12px; background: #140e09d9; border: 2px solid #e0a05066; color: var(--texte);
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 7px; row-gap: 5px; align-items: center;
  cursor: pointer; font: inherit; text-align: left; box-shadow: 0 4px 0 #0009; transition: opacity .3s; }
.breche .ico { grid-row: 1 / 3; font-size: 24px; line-height: 1; }
.breche .nom { font: 700 13px system-ui; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breche .court { display: none; } body.tactile .breche .long { display: none; } body.tactile .breche .court { display: inline; }
.breche .nom em { font-style: normal; color: var(--or); margin-left: 4px; }
.breche .t { height: 8px; background: #000a; border-radius: 3px; overflow: hidden; }
.breche .t div { height: 100%; background: #5fbf5a; transition: width .2s, background .3s; }
.breche.orange .t div { background: #e0a050; } .breche.rouge .t div { background: #d0332a; }
.breche.attaquee { border-color: #ff4a2a; animation: attaquee .5s ease-in-out infinite alternate; }
@keyframes attaquee { to { box-shadow: 0 4px 0 #0009, 0 0 16px #ff4a2a; } }
.breche.ici { border-color: var(--or); background: #2a1c10e6; }
.breche.cedee { border-color: #8a1a10; background: #3a0e0ae6; } .breche.cedee .nom { color: #ff8a6a; }
.breche.inactive { opacity: .35; }
.breche.cible { outline: 2px dashed var(--or); outline-offset: 2px; }
.breche:hover { border-color: var(--or); }

/* ---------- kléos (score), série, bronze ---------- */
#score { position: absolute; right: 24px; top: 14px; display: flex; align-items: center; gap: 12px; text-shadow: 0 1px 3px #000; pointer-events: none; }
#score .kleos { text-align: right; line-height: 1.15; }
#score .kleos b { display: block; font: 400 28px "Lilita One", system-ui; color: var(--or); }
#score .kleos span { font-size: 12px; color: #cbbd9f; }
#serie { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font: 400 21px "Lilita One", system-ui;
  background: radial-gradient(circle at 35% 30%, #6a5a48, #2a2018); border: 3px solid #8a7a60; color: var(--texte); transition: transform .15s; }
#serie.n2 { background: radial-gradient(circle at 35% 30%, #c08a3a, #5a3a14); border-color: #e0a050; }
#serie.n3 { background: radial-gradient(circle at 35% 30%, #ffb43a, #8a4a10); border-color: var(--or); box-shadow: 0 0 12px #ffb43a; }
#serie.n4 { background: radial-gradient(circle at 35% 30%, #ff7a3a, #8a1a10); border-color: #ffd27a; box-shadow: 0 0 18px #ff6a2a; animation: pret .4s ease-in-out infinite alternate; }
#serie.saute { transform: scale(1.3); }
#bronze { color: #e6b070; font-weight: 700; }

#centre { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); text-align: center; font: 600 40px system-ui; text-shadow: 0 2px 8px #000; pointer-events: none; width: 92vw; }
#annonce { position: absolute; left: 50%; top: 22%; translate: -50% 0; text-align: center; pointer-events: none; display: none; }
#annonce b { display: block; font: 400 48px "Lilita One", system-ui; color: var(--or); text-shadow: 0 3px 10px #000; letter-spacing: .04em; }
#annonce span { font-size: 17px; color: #e6d7b8; text-shadow: 0 1px 4px #000; }
#annonce.on { display: block; animation: annonce 2.6s ease-out forwards; }
@keyframes annonce { 0% { opacity: 0; transform: scale(1.4); } 12% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
#combo { position: absolute; right: 40px; top: 40%; font: 800 56px system-ui; color: var(--or); text-shadow: 0 3px 10px #000; pointer-events: none; }
#invite { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); font: 600 22px system-ui; color: var(--accent); text-shadow: 0 2px 6px #000; pointer-events: none; white-space: nowrap; }
#repit { position: absolute; left: 50%; top: calc(86px + env(safe-area-inset-top)); translate: -50% 0; display: none; padding: 6px 14px; border-radius: 12px;
  background: #140e09d9; border: 2px solid #6ab0ff88; text-align: center; pointer-events: none; }
#repit b { color: #9fd0ff; } #repit span { color: #cbbd9f; font-size: 13px; }
body.enRepit #repit { display: block; }
#debut { position: absolute; inset: 0; display: grid; place-items: center; background: #000a; cursor: pointer; font-size: 22px; text-align: center; padding: 20px; z-index: 9; }

/* ---------- téléphone : commandes tactiles ---------- */
#tactile { display: none; }
body.tactile #tactile { display: block; }
#tactile, #tactile * { touch-action: none; }
#zoneJoy { position: absolute; left: 0; top: 110px; bottom: 0; width: 50%; }
#joy { position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; background: #0004; border: 2px solid #f1e3c655; display: none; pointer-events: none; }
#joyPoint { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: #f1e3c6aa; box-shadow: 0 2px 6px #0008; }
#joyAide { position: absolute; left: calc(14px + env(safe-area-inset-left)); bottom: calc(18px + env(safe-area-inset-bottom)); color: #f1e3c688; font-size: 13px; pointer-events: none; }
#boutons { position: absolute; right: calc(14px + env(safe-area-inset-right)); bottom: calc(14px + env(safe-area-inset-bottom)); width: 236px; height: 200px; }
.bt { position: absolute; border-radius: 50%; border: 2px solid #e0a05099; background: #1a140ecc; color: var(--texte);
  font: 700 12px system-ui; display: grid; place-items: center; align-content: center; gap: 2px; padding: 0; box-shadow: 0 4px 0 #0009; }
.bt b { font-size: 24px; line-height: 1; }
.bt.appui { background: #e0a050; color: #1a140e; transform: translateY(2px); box-shadow: 0 2px 0 #0009; }
#bAttaque { right: 0; bottom: 0; width: 96px; height: 96px; } #bAttaque b { font-size: 34px; }
#bBouclier { right: 110px; bottom: 6px; width: 78px; height: 78px; }
#bEsquive { right: 98px; bottom: 100px; width: 66px; height: 66px; }
#bExec { right: 6px; bottom: 110px; width: 80px; height: 80px; opacity: .35; }
#bExec.pret { opacity: 1; border-color: var(--or); background: #6a3a14ee; animation: pret .8s ease-in-out infinite alternate; }
#bExec.action { opacity: 1; border-color: #9fd0ff; background: #14304aee; }
@keyframes pret { to { box-shadow: 0 4px 0 #0009, 0 0 18px #e0a050; } }
/* QTE au doigt : le guide du milieu montre le geste */
#qteGuide { position: absolute; left: 50%; top: 50%; width: 0; height: 0; display: none; pointer-events: none; z-index: 5; }
body.tactile.qte-attente #qteGuide { display: block; }
#qteGuide .rond { position: absolute; left: -38px; top: -38px; width: 76px; height: 76px; border-radius: 50%; border: 3px solid var(--or); background: #1a140e88; box-shadow: 0 0 22px #e0a05088; }
#qteGuide .piste { position: absolute; left: 0; top: 0; }
#qteGuide[data-dir="droite"] .piste { rotate: 90deg; } #qteGuide[data-dir="gauche"] .piste { rotate: -90deg; }
#qteGuide .trait { position: absolute; left: -5px; top: -150px; width: 10px; height: 150px; border-radius: 5px; background: linear-gradient(#ffd27a, #ffd27a00); opacity: .55; }
#qteGuide .fleche { position: absolute; left: -22px; top: -196px; width: 44px; text-align: center; font: 700 40px system-ui; color: var(--or); text-shadow: 0 2px 8px #000; }
#qteGuide .doigt { position: absolute; left: -16px; top: -16px; width: 32px; height: 32px; border-radius: 50%; background: #fff6; border: 2px solid #fff; animation: glisse .75s ease-in infinite; }
@keyframes glisse { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-140px); opacity: 0; } }
#qteGuide .temps { position: absolute; left: -90px; top: 60px; width: 180px; height: 6px; background: #0008; border-radius: 3px; overflow: hidden; }
#qteGuide .temps div { height: 100%; background: #e0a050; }
body.qte #boutons, body.qte #zoneJoy, body.qte #joyAide { display: none; }
@media (max-height: 500px) { #qteGuide { scale: .62; } }
/* téléphone tenu en portrait : le jeu attend qu'on le tourne */
#tourner { position: fixed; inset: 0; z-index: 80; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: #1a120b; color: var(--texte); text-align: center; padding: 24px; }
#tourner b { font: 400 30px "Lilita One", system-ui; color: var(--or); }
#tourner span { color: #b9a888; font-size: 15px; }
#tourner .tel { width: 58px; height: 100px; border: 4px solid var(--or); border-radius: 12px; margin-bottom: 14px; position: relative; animation: pivote 2.2s ease-in-out infinite; }
#tourner .tel::after { content: ""; position: absolute; left: 50%; bottom: 6px; width: 12px; height: 4px; margin-left: -6px; border-radius: 2px; background: var(--or); }
@keyframes pivote { 0%, 20% { rotate: 0deg; } 55%, 85% { rotate: -90deg; } 100% { rotate: 0deg; } }
@media (orientation: portrait) and (pointer: coarse) { body:not(.trailer) #tourner { display: flex; } }
body.trailer #tactile, body.trailer #bMenu, body.trailer #score, body.trailer #hud, body.trailer #breches, body.trailer #carte, body.trailer #centre,
body.trailer #invite, body.trailer #combo, body.trailer #debut, body.trailer #qteGuide, body.trailer #repit { display: none !important; }
body.fin #tactile, body.fin #bMenu, body.fin #centre, body.fin #invite, body.fin #combo, body.fin #annonce, body.fin #repit, body.fin .alerte { display: none; }

/* ---------- menu ☰, pause, fin ---------- */
#bMenu { position: absolute; right: 24px; top: 84px; width: 44px; height: 44px; border-radius: 12px; border: 2px solid #e0a05077; background: #1a140ecc; color: var(--texte); font: 700 20px system-ui; cursor: pointer; }
#pause, #fin { position: absolute; inset: 0; display: none; place-items: center; background: #0b0805ee; z-index: 20; }
#fin { background: #0b0805cc; animation: apparait .5s ease-out; }
@keyframes apparait { from { opacity: 0; } }
body.enpause #pause, body.fin #fin { display: grid; }
#pause > div, #fin > div { display: flex; flex-direction: column; gap: 12px; width: min(84vw, 360px); max-height: 94vh; overflow: auto; padding: 4px 4px 8px; }
#pause h2, #fin h2 { margin: 0 0 6px; text-align: center; font: 400 38px "Lilita One", system-ui; color: var(--or); }
#fin p { margin: 0 0 8px; text-align: center; line-height: 1.5; color: #e6d7b8; }
#pause button, #pause a, #fin button, #fin a { min-height: 50px; border-radius: 14px; border: 2px solid #e0a05099; background: #1a140e; color: var(--texte);
  font: 700 16px system-ui; display: grid; place-items: center; text-decoration: none; box-shadow: 0 4px 0 #000b; cursor: pointer; }
#pause .duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
#pause .principal, #fin .principal { background: #e0a050; color: #1a140e; border-color: var(--or); }
#pause .touches { font-size: 13px; line-height: 1.6; color: #cbbd9f; text-align: center; }
#pause .touches b { color: var(--texte); }
body.tactile #pause .touches { display: none; }
#fin .envoi { display: flex; gap: 12px; }
#fin input { flex: 1; min-width: 0; min-height: 46px; border-radius: 12px; border: 2px solid #4a3f31; background: #1a140e; color: var(--texte); font: 600 16px system-ui; padding: 0 12px; }
#fin .envoi button { min-height: 46px; padding: 0 14px; }
#finScore { margin: 0; text-align: center; color: var(--or); } #finScore b { font-size: 22px; }
#finDetail { margin: 0; font-size: 13px; color: #cbbd9f; text-align: center; line-height: 1.5; }
#finClassement h3 { margin: 6px 0; text-align: center; font: 400 18px "Lilita One", system-ui; color: var(--or); }
.classement { margin: 0; padding-left: 26px; max-height: 30vh; overflow: auto; font-size: 14px; }
.classement li { padding: 3px 0; } .classement li.moi { color: var(--or); }
.classement span { color: #9a8b74; margin: 0 8px; font-size: 12px; } .classement em { font-style: normal; float: right; font-weight: 700; }
@media (max-height: 520px) {
  #fin > div { width: min(94vw, 780px); display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; row-gap: 10px; align-items: start;
    grid-template-areas: "t e" "x c" "s c" "d c" "v c" "r m"; }
  #finTitre { grid-area: t; font-size: 30px !important; } #finTexte { grid-area: x; margin: 0 !important; } #finScore { grid-area: s; } #finDetail { grid-area: d; }
  #fin .envoi { grid-area: e; } #finClassement { grid-area: c; } #bRejouer { grid-area: r; } #fin > div > a { grid-area: m; } #bAvis { grid-area: v; min-height: 42px !important; }
  .classement { max-height: 34vh; }
  #pause > div { width: min(94vw, 640px); display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  #pause h2, #pause .touches, #pause .principal { grid-column: 1 / -1; }
}

/* ---------- radar de combat (toucher un point = verrouiller un Grec) ---------- */
#carte { position: absolute; right: 24px; top: 140px; width: 150px; height: 150px; border-radius: 50%; background: #0b0805cc;
  border: 1px solid #e0a05099; display: none; cursor: pointer; touch-action: none; }
body.radar #carte { display: block; }
.barre .deseq { position: absolute; left: 0; bottom: -5px; height: 3px; width: 0; background: #e0a050; display: block; }
.barre.verrou { border-color: var(--or); box-shadow: 0 0 0 2px var(--or); }
.barre.menace { box-shadow: 0 0 0 2px #ff4a2a, 0 0 14px #ff4a2a; }
.barre.hoplite { border-color: #9aa3a8; } .barre.colosse { height: 13px; border-color: #b0302a; } .barre.lanceur { border-color: #9fbf6a; }
.barre.porteur, .barre.pousseur { border-color: #c9a46a; } .barre.achille { height: 14px; border-color: var(--accent); }
/* Achille : barre de boss en haut */
#boss { position: absolute; left: 50%; top: calc(14px + env(safe-area-inset-top)); translate: -50% 0; width: min(520px, 60vw); display: none; text-align: center; pointer-events: none; }
body.boss #boss { display: block; } body.boss #breches { display: none; }
#boss b { display: block; font: 400 22px "Lilita One", system-ui; letter-spacing: .12em; color: var(--or); text-shadow: 0 2px 6px #000; }
#boss > div { height: 12px; background: #000a; border: 2px solid #8a1a10; border-radius: 3px; position: relative; }
#boss > div::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; background: var(--or); }
#boss > div > div { height: 100%; width: 100%; background: linear-gradient(#e6c06a, #a8762e); transition: width .2s; }
#boss.phase2 > div { border-color: #ff4a2a; box-shadow: 0 0 10px #ff4a2a; }
.alerte { position: absolute; width: 0; height: 0; display: none; pointer-events: none; z-index: 4; translate: -50% -50%;
  border-left: 16px solid transparent; border-right: 16px solid transparent; border-bottom: 26px solid #ff3a1a; filter: drop-shadow(0 0 8px #ff3a1a); animation: alerte .3s ease-in-out infinite alternate; }
@keyframes alerte { to { opacity: .55; } }
/* étiquettes des estrades (ateliers, faveurs, cor) */
.etiquette { position: absolute; translate: -50% -100%; min-width: 120px; max-width: 200px; padding: 6px 10px 7px; border-radius: 10px;
  background: #140e09d9; border: 1px solid #e0a05055; text-align: center; pointer-events: none; font-size: 12px; line-height: 1.3; color: #e6d7b8; display: none; }
.etiquette b { display: block; font-size: 14px; color: var(--or); }
.etiquette span, .etiquette i, .etiquette em, .etiquette small { display: block; }
.etiquette i { color: #9a8b74; font-size: 11px; }
.etiquette em { font-style: normal; font-weight: 700; color: #e6b070; }
.etiquette em.cher { color: #9a8b74; }
.etiquette small { color: #9a8b74; font-size: 11px; margin-top: 2px; }
.etiquette .jauge { height: 4px; margin-top: 4px; background: #0008; border-radius: 2px; overflow: hidden; display: none; }
.etiquette .jauge div { height: 100%; width: 0; background: var(--or); }
.etiquette.proche { border-color: var(--or); transform: scale(1.12); z-index: 3; }
.etiquette.proche .jauge { display: block; }
/* chiffres qui s'envolent (dégâts, kléos) */
.chiffre { position: absolute; pointer-events: none; font: 700 22px system-ui; text-shadow: 0 2px 4px #000; white-space: nowrap; }

/* ---------- téléphone : l'interface monte en haut, le bas reste aux pouces ---------- */
body.tactile #hud { left: calc(12px + env(safe-area-inset-left)); top: calc(18px + env(safe-area-inset-top)); bottom: auto; width: clamp(150px, 24vw, 230px); gap: 16px; }
body.tactile .jauge { grid-template-columns: 20px 1fr auto; gap: 6px; }
body.tactile .jauge i { font-size: 16px; } body.tactile .jauge b { font-size: 13px; min-width: 34px; }
body.tactile .jauge small { left: 26px; top: -13px; font-size: 10px; }
body.tactile #breches { gap: 8px; top: calc(8px + env(safe-area-inset-top)); }
body.tactile .breche { width: clamp(84px, 13vw, 118px); padding: 5px 7px 6px; column-gap: 5px; row-gap: 4px; }
body.tactile .breche .ico { font-size: 18px; } body.tactile .breche .nom { font-size: 11px; }
body.tactile #score { right: calc(66px + env(safe-area-inset-right)); top: calc(8px + env(safe-area-inset-top)); gap: 8px; }
body.tactile #score .kleos b { font-size: 21px; } body.tactile #score .kleos span { font-size: 11px; }
body.tactile #serie { width: 42px; height: 42px; font-size: 16px; border-width: 2px; }
body.tactile #bMenu { right: calc(12px + env(safe-area-inset-right)); top: calc(8px + env(safe-area-inset-top)); }
body.tactile #carte { right: calc(12px + env(safe-area-inset-right)); top: calc(62px + env(safe-area-inset-top)); width: 96px; height: 96px; }
body.tactile #repit { top: auto; bottom: calc(12px + env(safe-area-inset-bottom)); font-size: 13px; }
body.tactile #invite { bottom: auto; top: 26%; font-size: 18px; }
body.tactile #combo { right: 16px; top: 36%; font-size: 40px; }
body.tactile #centre { top: 40%; font-size: 30px; }
body.tactile #annonce b { font-size: 34px; } body.tactile #annonce { top: 24%; }
body.tactile #boss { width: min(360px, 46vw); } body.tactile #boss b { font-size: 16px; }
body.tactile .etiquette { font-size: 11px; max-width: 150px; min-width: 100px; }
body.tactile .chiffre { font-size: 18px; }
