@import url(../assets/fonts/fonts.css);

:root {
  --gold: #e8c060;
  --gold2: #f5dc9a;
  --ink: #f3ead6;
  --muted: #b9ab8e;
  --panel: rgba(24, 18, 12, 0.86);
  --panel2: rgba(40, 30, 20, 0.92);
  --line: rgba(232, 192, 96, 0.35);
  --ok: #7fdc6a;
  --warn: #f0b040;
  --danger: #ff5a4a;
  --title: "Cinzel", "Palatino Linotype", Georgia, serif;
  --deco: "Cinzel Decorative", "Cinzel", Georgia, serif;
  --ui: "Alegreya Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--ink); font-family: var(--ui); user-select: none; }
#app { position: fixed; inset: 0; }
#gl, #overlay2d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#overlay2d { pointer-events: none; }
.hidden { display: none !important; }

button { font-family: var(--ui); }

/* ---------------------------------------------------------------- chargement */
#loading {
  position: absolute; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(ellipse at 50% 40%, #2a2216 0%, #0b0906 70%);
  transition: opacity 0.7s;
}
#loading.gone { opacity: 0; pointer-events: none; }
.load-title { font-family: var(--deco); font-size: 56px; color: var(--gold); text-shadow: 0 4px 30px rgba(232, 160, 60, 0.4); letter-spacing: 2px; }
.load-bar { width: 380px; height: 8px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: rgba(0, 0, 0, 0.4); }
#load-fill { height: 100%; width: 0; background: linear-gradient(90deg, #b07a30, var(--gold)); transition: width 0.3s; }
/* (21/11, retour de l'utilisateur : « lenteur au debut d'une nouvelle partie ») la creation de la carte bloque le jeu quelques secondes :
   un reflet parcourt la barre sans arret (anime par la carte graphique, il bouge meme pendant ce calcul) : on voit que le jeu travaille */
.load-bar { position: relative; }
.load-bar::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 30%; background: linear-gradient(90deg, transparent, rgba(255, 236, 190, 0.6), transparent); animation: loadGlint 1.4s linear infinite; will-change: transform; }
@keyframes loadGlint { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
#load-text { color: var(--muted); min-height: 50px; font-size: 16px; }

/* ---------------------------------------------------------------- ecrans / menus */
#screens { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
#screens > * { pointer-events: auto; }
.screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; animation: fadeIn 0.4s; }
.screen.dim { background: rgba(0, 0, 0, 0.55); }   /* (18/10) plus de flou d arriere-plan : recalcule a chaque image sur le village 3D anime, il ralentissait les menus */
.screen.red { background: radial-gradient(ellipse, rgba(60, 0, 0, 0.4), rgba(0, 0, 0, 0.8)); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.main-menu { justify-content: flex-start; background: linear-gradient(90deg, rgba(8, 6, 3, 0.82) 0%, rgba(8, 6, 3, 0.5) 32%, rgba(0, 0, 0, 0) 55%); }
.menu-left { margin-left: 7vw; display: flex; flex-direction: column; gap: 28px; }
.logo { text-align: left; }
.logo-top { font-family: var(--title); font-size: 26px; color: var(--gold2); letter-spacing: 8px; margin-bottom: -6px; text-shadow: 0 2px 10px #000; }
.logo-main { font-family: var(--deco); font-size: 64px; line-height: 1.05; color: var(--gold); text-shadow: 0 3px 0 #5a3a10, 0 6px 30px rgba(0, 0, 0, 0.9); }
.logo-sub { font-family: var(--title); color: var(--ink); opacity: 0.85; letter-spacing: 3px; margin-top: 6px; text-shadow: 0 2px 8px #000; }
.menu-buttons { display: flex; flex-direction: column; gap: 10px; width: 300px; }
.record { color: var(--gold2); font-family: var(--title); text-shadow: 0 2px 8px #000; }
.menu-version { position: absolute; right: 16px; bottom: 12px; color: rgba(255, 255, 255, 0.45); font-size: 13px; }

.mbtn {
  font-family: var(--title); font-size: 18px; letter-spacing: 1px; color: var(--ink); cursor: pointer;
  padding: 11px 20px; border-radius: 6px; text-align: left;
  background: linear-gradient(180deg, rgba(70, 52, 30, 0.85), rgba(35, 25, 14, 0.9));
  border: 1px solid var(--line); box-shadow: inset 0 1px 0 rgba(255, 230, 170, 0.12), 0 4px 14px rgba(0, 0, 0, 0.4);
  transition: transform 0.12s, border-color 0.12s, background 0.12s;
}
.mbtn:hover { transform: translateX(4px); border-color: var(--gold); background: linear-gradient(180deg, rgba(100, 74, 40, 0.9), rgba(50, 35, 18, 0.95)); }
.mbtn.primary { background: linear-gradient(180deg, #a8782e, #6a4616); border-color: var(--gold); color: #fff6dd; }
.mbtn.primary:hover { background: linear-gradient(180deg, #c08c38, #7a521c); }
.mbtn.small { font-size: 14px; padding: 7px 14px; margin-top: 10px; }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 26px 30px; min-width: 380px; max-width: 92vw; max-height: 88vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), inset 0 0 0 1px rgba(0, 0, 0, 0.5);
}
.panel.wide { width: 760px; }
.panel.narrow { width: 340px; display: flex; flex-direction: column; gap: 10px; }
.panel h1, .panel h2 { font-family: var(--title); color: var(--gold); margin: 0 0 16px; letter-spacing: 1px; }
.panel h2 { font-size: 28px; }
.panel h3 { font-family: var(--title); color: var(--gold2); margin: 0 0 6px; font-size: 18px; }
.panel p { line-height: 1.5; color: var(--ink); }
.note { color: var(--muted); font-size: 14px; margin-top: 12px; }
.row-btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.row-btns .mbtn { text-align: center; min-width: 140px; }

.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid rgba(232, 192, 96, 0.1); }
.opt-row label { font-size: 16px; display: flex; flex-direction: column; }
.opt-row label small { color: var(--muted); font-size: 12px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; flex-wrap: wrap; }
.seg button { background: rgba(0, 0, 0, 0.3); color: var(--ink); border: none; padding: 7px 12px; cursor: pointer; font-size: 14px; border-right: 1px solid rgba(232, 192, 96, 0.15); }
.seg button:last-child { border-right: none; }
.seg button:hover { background: rgba(232, 192, 96, 0.15); }
.seg button.on { background: linear-gradient(180deg, #a8782e, #6a4616); color: #fff; }
.slider { display: flex; align-items: center; gap: 10px; }
.slider input { width: 220px; accent-color: var(--gold); }
.slider span { width: 64px; text-align: right; color: var(--gold2); font-variant-numeric: tabular-nums; }
.tabs.big { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs.big button { flex: 1; padding: 9px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); color: var(--ink); border-radius: 6px; cursor: pointer; font-size: 15px; }
.tabs.big button.on { background: linear-gradient(180deg, #a8782e, #6a4616); }
#opt-body { min-height: 360px; }
.cfg-grid { display: grid; grid-template-columns: 170px 1fr 1fr; gap: 0; font-size: 15px; border: 1px solid rgba(232, 192, 96, 0.25); border-radius: 8px; overflow: hidden; }
.cfg-grid > div { padding: 8px 12px; border-bottom: 1px solid rgba(232, 192, 96, 0.1); }
.cfg-grid > .h { background: rgba(232, 192, 96, 0.14); color: var(--gold2); font-weight: 700; }
.cfg-grid > .k { color: var(--gold2); font-weight: 700; }
.cfg-me { display: flex; flex-direction: column; gap: 4px; margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: rgba(255, 255, 255, 0.05); font-size: 15px; }
.cfg-me b { color: var(--gold2); }
.cfg-tier.ok { color: #7ee08a; } .cfg-tier.mid { color: #f0c860; } .cfg-tier.low { color: #f08060; }
.keys { display: grid; grid-template-columns: 200px 1fr; gap: 6px 14px; font-size: 15px; }
.keys .k { color: var(--gold2); font-weight: 700; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 26px; }
.help-grid p { font-size: 15px; margin: 4px 0 10px; }

.gameover { text-align: center; }
.gameover h1 { font-family: var(--deco); font-size: 44px; color: #ff7a5a; }
.gameover .big { font-size: 22px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0; }
.stats div { background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: 8px; padding: 12px 8px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.stats b { font-size: 26px; color: var(--gold); font-family: var(--title); }

/* ---------------------------------------------------------------- intro */
#subtitles {
  position: absolute; left: 50%; bottom: 9vh; transform: translateX(-50%); z-index: 25; width: min(1000px, 86vw);
  text-align: center; font-family: var(--title); font-size: 24px; line-height: 1.45; color: #fff4dc;
  text-shadow: 0 2px 4px #000, 0 0 18px rgba(0, 0, 0, 0.9); opacity: 0; transition: opacity 0.8s; pointer-events: none;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0) 70%); padding: 18px 30px;
}
#subtitles.on { opacity: 1; }
#fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity 0.9s; z-index: 40; }
#fade.on { opacity: 1; }
.skip-btn { position: absolute; right: 24px; bottom: 24px; background: rgba(0, 0, 0, 0.5); border: 1px solid var(--line); color: var(--ink); padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 15px; }
.skip-btn:hover { border-color: var(--gold); }
.intro-title { position: absolute; top: 26vh; left: 0; right: 0; text-align: center; animation: titleIn 3s ease-out; }
.intro-title .logo-main { font-size: 84px; }
.intro-title .logo-top { font-size: 34px; }
@keyframes titleIn { from { opacity: 0; transform: scale(1.1); } to { opacity: 1; transform: none; } }   /* (31/10 : plus d'espacement des lettres anime, tres lourd a recalculer) */
.intro-title { will-change: opacity, transform; }
.intro-title.attente { opacity: 0; animation: none; }
.intro-title.attente .logo-main { animation: none; }

/* ---------------------------------------------------------------- HUD */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; font-size: 15px; }
#hud > * { pointer-events: auto; }
#topbar {
  position: absolute; top: 0; left: 0; right: 0; height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 12px;
  background: linear-gradient(180deg, rgba(20, 14, 8, 0.92), rgba(20, 14, 8, 0.75)); border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
#res-list { display: flex; gap: 4px; }
.res { display: flex; align-items: center; gap: 5px; padding: 4px 9px; background: rgba(0, 0, 0, 0.35); border-radius: 5px; border: 1px solid rgba(232, 192, 96, 0.14); min-width: 78px; }
.ri { font-size: 17px; }
.rv { font-weight: 700; font-variant-numeric: tabular-nums; }
#pop { padding: 4px 12px; background: linear-gradient(180deg, #2a6a3a, #163e22); border-radius: 5px; border: 1px solid #7ee08e; font-weight: 800; font-size: 15px; color: #eaffea; text-shadow: 0 1px 2px #000; box-shadow: 0 0 6px rgba(120, 230, 140, 0.35); }   /* (14/11, « l info du nombre de paysans : change sa couleur, plus visible ») */
#pop.full { color: var(--warn); border-color: var(--warn); }
/* (08/11, retour testeur : « quand le nombre de paysans est a 25/25 en haut de l'ecran, un avertissement clignotant ») */
#pop.full { animation: popPlein 1.1s ease-in-out infinite; }
#pop .pop-max { margin-left: 8px; font-size: 12px; font-weight: 700; color: #1a1208; background: var(--warn); padding: 1px 7px; border-radius: 4px; letter-spacing: 0.3px; }
@keyframes popPlein { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 170, 60, 0); background: rgba(0, 0, 0, 0.35); } 50% { box-shadow: 0 0 12px 2px rgba(255, 170, 60, 0.75); background: rgba(120, 50, 10, 0.55); } }
.spacer { flex: 1; }
#clock { display: flex; align-items: center; gap: 8px; min-width: 210px; }
#clock-icon { font-size: 26px; filter: drop-shadow(0 0 6px rgba(255, 200, 80, 0.6)); }
#clock-day { font-family: var(--title); font-weight: 800; color: var(--gold); font-size: 17px; }
#clock-bar { width: 150px; height: 6px; background: rgba(0, 0, 0, 0.5); border-radius: 3px; overflow: hidden; margin: 2px 0; }
#clock-fill { height: 100%; background: linear-gradient(90deg, #f0d070, #f08040); }
#clock-fill.night { background: linear-gradient(90deg, #5070c0, #a0b8ff); }
#clock-left { font-size: 12px; color: var(--muted); }
#clock-left.warn { color: var(--warn); font-weight: 700; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.5; } }
.hbtn { background: rgba(0, 0, 0, 0.35); color: var(--ink); border: 1px solid var(--line); border-radius: 5px; padding: 6px 10px; cursor: pointer; font-size: 14px; }
.hbtn:hover { border-color: var(--gold); background: rgba(232, 192, 96, 0.15); }
.hbtn.on { background: linear-gradient(180deg, #a8782e, #6a4616); color: #fff; }
#btn-bell.on { background: linear-gradient(180deg, #b03a2a, #6a1a10); animation: blink 1s infinite; }
#speed { display: flex; gap: 2px; }

#hint { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); padding: 7px 16px; border-radius: 6px; color: var(--gold2); pointer-events: none; }
#notifs { position: absolute; left: 12px; bottom: 250px; display: flex; flex-direction: column-reverse; gap: 5px; pointer-events: none; width: 420px; }
.notif { background: rgba(15, 10, 6, 0.82); border-left: 3px solid var(--gold); padding: 6px 12px; border-radius: 4px; transition: opacity 1s; font-size: 15px; animation: slideIn 0.3s; }
.notif.ok { border-color: var(--ok); }
.notif.warn { border-color: var(--warn); }
.notif.danger { border-color: var(--danger); color: #ffd0c8; }
.notif.fade { opacity: 0; }
@keyframes slideIn { from { transform: translateX(-20px); opacity: 0; } }

#minimap-wrap { position: absolute; left: 10px; bottom: 10px; padding: 5px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); }
#minimap { display: block; width: 220px; height: 220px; border-radius: 4px; cursor: crosshair; }
#mm-leg { position: absolute; right: 8px; top: 8px; width: 20px; height: 20px; padding: 0; border-radius: 50%; border: 1px solid var(--gold); background: rgba(10,12,20,.8); color: var(--gold); font: bold 13px/18px Georgia, serif; cursor: pointer; }
#mm-leg:hover { background: var(--gold); color: #101018; }
#mm-grand { position: absolute; right: 32px; top: 8px; width: 20px; height: 20px; padding: 0; border-radius: 4px; border: 1px solid var(--gold); background: rgba(10,12,20,.8); color: var(--gold); font: bold 14px/17px Georgia, serif; cursor: pointer; }
#mm-grand:hover, #mm-grand.on { background: var(--gold); color: #101018; }
#mm-legende { position: absolute; left: 0; bottom: calc(100% + 6px); width: 230px; padding: 8px 10px; background: var(--panel); border: 1px solid var(--gold); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.5); font-size: 12px; }
#mm-legende .ml-t { font-family: var(--title); color: var(--gold); margin-bottom: 4px; }
#mm-legende .ml { display: flex; align-items: center; gap: 8px; padding: 1.5px 0; }
#mm-legende .ml i, #mm-legende .ml b { flex: none; display: inline-block; width: 10px; height: 10px; margin: 0 3px; font-style: normal; font-weight: normal; line-height: 10px; font-size: 11px; text-align: center; box-shadow: 0 0 0 1px #000; }
#mm-legende .ml b { box-shadow: none; }
#merchant .mr { display: flex; justify-content: flex-end; padding-top: 6px; border-top: 1px solid rgba(232,192,96,0.15); }
#minimap-cam { position: absolute; left: 5px; top: 5px; width: 220px; height: 220px; pointer-events: none; z-index: 2; }

#selpanel {
  position: absolute; left: 250px; bottom: 10px; width: 330px; min-height: 120px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.sel-head { display: flex; gap: 12px; align-items: center; }
.sel-icon { font-size: 40px; width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.4); border-radius: 8px; border: 1px solid var(--line); }
.sel-name { font-family: var(--title); font-weight: 800; color: var(--gold); font-size: 18px; }
.sel-sub { color: var(--muted); font-size: 14px; margin-top: 3px; }
.sel-desc { color: var(--ink); font-size: 14px; margin-top: 8px; opacity: 0.85; }
.sel-stats { margin-top: 8px; font-size: 14px; }
.sel-warn { color: var(--warn); font-size: 13px; margin-top: 4px; }
.hpbar { width: 200px; height: 7px; background: rgba(0, 0, 0, 0.5); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.hpbar div { height: 100%; background: linear-gradient(90deg, #4cc040, #8ae060); }
.hpbar.blue div { background: linear-gradient(90deg, #4080e0, #80b0ff); }
.hpbar.red div { background: linear-gradient(90deg, #c03030, #f06050); }
.sel-multi { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.sel-multi.grid { gap: 3px; }
.chip { background: rgba(0, 0, 0, 0.4); border: 1px solid var(--line); padding: 3px 8px; border-radius: 12px; }
.mini { width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; background: linear-gradient(0deg, rgba(80, 200, 70, 0.45) calc(var(--k) * 100%), rgba(0, 0, 0, 0.4) 0); border-radius: 4px; font-size: 15px; }
.queue { display: flex; gap: 4px; margin-top: 8px; }
.qi { position: relative; width: 34px; height: 34px; background: rgba(0, 0, 0, 0.4); border: 1px solid var(--line); border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 20px; cursor: pointer; overflow: hidden; }
.qbar { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--gold); }
.sbtn { background: rgba(0, 0, 0, 0.4); border: 1px solid var(--line); color: var(--ink); padding: 3px 9px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.sbtn:hover { border-color: var(--gold); }
.sbtn.buy { background: linear-gradient(180deg, #a8782e, #6a4616); color: #fff; padding: 6px 12px; }
.sbtn:disabled { opacity: 0.4; cursor: default; }

#cmdpanel {
  position: absolute; right: 10px; bottom: 10px; width: 420px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.tab { flex: 1; background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(232, 192, 96, 0.2); color: var(--ink); padding: 5px; border-radius: 5px; cursor: pointer; font-size: 14px; }
.tab.on { background: linear-gradient(180deg, #a8782e, #6a4616); border-color: var(--gold); }
.cgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.cbtn {
  height: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer;
  background: linear-gradient(180deg, rgba(70, 52, 30, 0.9), rgba(35, 25, 14, 0.95)); border: 1px solid rgba(232, 192, 96, 0.3); border-radius: 6px; color: var(--ink); padding: 3px;
}
.cbtn:hover { border-color: var(--gold); transform: translateY(-1px); }
.cbtn.off { opacity: 0.5; }
.cbtn.locked { opacity: 0.4; filter: grayscale(0.8); }
.cbtn.danger:hover { border-color: var(--danger); }
.ci { font-size: 26px; line-height: 1; }
.cl { font-size: 11px; text-align: center; line-height: 1.1; }
.cost { white-space: nowrap; margin-right: 4px; }
.cost.lack { color: #ff7a6a; }

#tooltip { position: fixed; z-index: 30; max-width: 260px; background: rgba(12, 8, 4, 0.96); border: 1px solid var(--gold); border-radius: 6px; padding: 8px 10px; font-size: 14px; line-height: 1.4; pointer-events: none; }
#tooltip b { color: var(--gold); }

#unlockpanel {
  position: absolute; top: 58px; right: 12px; width: 440px; max-height: calc(100vh - 330px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}
.up-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.up-head b { font-family: var(--title); color: var(--gold); font-size: 18px; }
.up-head span { flex: 1; color: var(--muted); font-size: 13px; }
.up-list { display: flex; flex-direction: column; gap: 6px; }
.up-row { display: flex; align-items: center; gap: 10px; padding: 8px; background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(232, 192, 96, 0.15); border-radius: 6px; }
.up-row.done { opacity: 0.55; }
.up-row.pending { border-color: #6aa0ff; }
.up-row.locked { opacity: 0.5; }
.up-icon { font-size: 28px; width: 40px; text-align: center; }
.up-txt { flex: 1; font-size: 13px; color: var(--muted); }
.up-txt b { color: var(--ink); font-size: 15px; }

#idlebtn { position: absolute; left: 250px; bottom: 150px; background: var(--panel2); border: 1px solid var(--warn); color: var(--warn); padding: 4px 10px; border-radius: 5px; cursor: pointer; font-weight: 700; }

/* (18/11, demande de l'utilisateur) compteur d'images en bas a droite de l'ecran, par-dessus tout, sans gener les clics */
#fps { position: fixed; right: 4px; bottom: 2px; pointer-events: none; z-index: 300; background: rgba(0, 0, 0, 0.5); padding: 2px 8px; border-radius: 4px; font-size: 13px; color: #8f8; font-variant-numeric: tabular-nums; }

@media (max-width: 1250px) {
  .res { min-width: 60px; padding: 3px 6px; }
  #clock { min-width: 170px; }
  #clock-bar { width: 110px; }
  #cmdpanel { width: 360px; }
  #selpanel { width: 280px; }
}

/* ---------------------------------------------------------------- bannieres & objectifs */
#banner { position: absolute; top: 18vh; left: 0; right: 0; text-align: center; pointer-events: none !important; opacity: 0; transform: scale(1.08); transition: opacity 1s, transform 1.2s; }
#banner.show { opacity: 1; transform: none; }
#banner .bt { font-family: var(--deco); font-size: 72px; color: var(--gold); text-shadow: 0 4px 0 #3a2008, 0 0 40px rgba(0, 0, 0, 0.9); }
#banner.night .bt { color: #ff6a50; text-shadow: 0 4px 0 #300808, 0 0 50px rgba(255, 40, 20, 0.5); }
#banner .bs { font-family: var(--title); font-size: 24px; color: var(--ink); text-shadow: 0 2px 8px #000; margin-top: 4px; }
#objectives { position: absolute; top: 58px; left: 12px; width: 330px; background: rgba(15, 10, 6, 0.72); border: 1px solid rgba(232, 192, 96, 0.25); border-radius: 8px; padding: 8px 12px; font-size: 14px; }
.obj-head { font-family: var(--title); color: var(--gold); display: flex; justify-content: space-between; }
#obj-toggle { cursor: pointer; padding: 0 6px; }
.obj { color: var(--ink); margin-top: 5px; line-height: 1.3; }
.obj.done { color: var(--ok); }
.mbtn small { font-family: var(--ui); font-size: 13px; opacity: 0.85; }

/* ---------------------------------------------------------------- civilisations & ages */
#civ-badge { display: flex; align-items: center; gap: 8px; padding: 2px 10px 2px 4px; background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(232, 192, 96, 0.2); border-radius: 5px; }
#civ-flag { width: 36px; height: 24px; border-radius: 2px; box-shadow: 0 1px 4px #000; }
#civ-name { font-family: var(--title); font-size: 12px; color: var(--gold2); line-height: 1.1; }
#age-name { font-size: 12px; color: var(--muted); line-height: 1.1; }
.civ-title { font-family: var(--title); color: var(--gold2); margin: 6px 0 8px; }
.civs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 8px; }
.civ { background: rgba(0, 0, 0, 0.35); border: 2px solid rgba(232, 192, 96, 0.2); border-radius: 8px; padding: 10px 8px; color: var(--ink); cursor: pointer; text-align: center; transition: transform 0.12s, border-color 0.12s; }
.civ:hover { transform: translateY(-2px); border-color: var(--gold); }
.civ.on { border-color: var(--gold); background: rgba(168, 120, 46, 0.35); box-shadow: 0 0 18px rgba(232, 192, 96, 0.35); }
.civ img { width: 96px; height: 64px; border-radius: 3px; box-shadow: 0 2px 8px #000; }
.civ-name { font-family: var(--title); font-weight: 800; color: var(--gold); margin: 6px 0 4px; font-size: 14px; }
.civ-unit { font-size: 13px; }
.civ-bonus { font-size: 12px; color: var(--muted); margin-top: 4px; }
.up-age { font-family: var(--title); color: var(--gold); margin: 8px 0 2px; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.up-age.future { color: var(--muted); }
.up-row.age { opacity: 0.5; }
.up-row.veiled { opacity: 0.6; background: rgba(40, 40, 40, 0.55); border-color: rgba(160, 160, 160, 0.18); filter: grayscale(1); color: #9a9a9a; }
.up-row.veiled .up-icon { filter: brightness(0) opacity(0.45); }
.up-row.veiled b { color: #a8a8a8; font-style: italic; }
.cbtn.age { border-color: var(--gold); background: linear-gradient(180deg, rgba(120, 90, 30, 0.95), rgba(60, 40, 14, 0.95)); }
.panel.wide:has(.civs) { width: 900px; }
#btn-idle.alert { border-color: var(--warn); color: var(--warn); font-weight: 700; animation: blink 1.4s infinite; }

/* ---------------------------------------------------------------- meteo, marchand, trophees */
#wx-icon { font-size: 20px; }
#merchant { position: absolute; top: 58px; right: 12px; width: 400px; background: var(--panel); border: 1px solid var(--gold); border-radius: 8px; padding: 10px 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.6); }
#merchant .mh { font-family: var(--title); color: var(--gold); display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
#merchant .mh span { flex: 1; color: var(--muted); font-size: 12px; font-family: var(--ui); }
#merchant .mo { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; border-top: 1px solid rgba(232,192,96,0.15); }
#merchant .mo.done { opacity: 0.5; }
#trophy-pop { position: absolute; right: 16px; top: 96px; display: flex; flex-direction: column; gap: 8px; pointer-events: none !important; }
.trophy { display: flex; gap: 10px; align-items: center; background: linear-gradient(180deg, #5a3f14, #2a1c08); border: 1px solid var(--gold); border-radius: 8px; padding: 8px 14px; box-shadow: 0 6px 24px rgba(0,0,0,0.6); animation: slideIn 0.4s; transition: opacity 0.7s; }
.trophy.out { opacity: 0; }
.trophy .ti { font-size: 28px; }
.trophy .tt { font-family: var(--title); color: var(--gold); }
.trophies { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tr { background: rgba(0,0,0,0.35); border: 1px solid rgba(232,192,96,0.15); border-radius: 6px; padding: 8px 10px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.tr.on { color: var(--ink); border-color: var(--gold); }
.posts { margin-top: 8px; background: rgba(0,0,0,0.3); border: 1px solid rgba(232,192,96,0.2); border-radius: 6px; padding: 6px 8px; }
.posts-h { font-family: var(--title); color: var(--gold2); font-size: 13px; margin-bottom: 4px; }
.post { display: flex; gap: 8px; align-items: center; font-size: 13px; padding: 3px 4px; color: var(--muted); border-radius: 4px; }
.post.on { color: var(--ink); cursor: pointer; }
.post.on:hover { background: rgba(232,192,96,0.15); }
.post .pa { flex: 1; }
.post .pc { color: var(--gold2); font-variant-numeric: tabular-nums; }
.langs { padding: 10px 0; }
.lang-title { font-family: var(--title); color: var(--gold2); font-size: 18px; margin-bottom: 12px; }
.lang-choices { display: flex; gap: 16px; }
.lang { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px; background: rgba(0,0,0,0.35); border: 2px solid rgba(232,192,96,0.2); border-radius: 10px; color: var(--ink); cursor: pointer; font-size: 18px; font-family: var(--title); }
.lang:hover { border-color: var(--gold); transform: translateY(-2px); }
.lang.on { border-color: var(--gold); background: rgba(168,120,46,0.35); box-shadow: 0 0 18px rgba(232,192,96,0.35); }
.lang .lf { font-size: 48px; }
.cbtn.sel { border-color: var(--gold); box-shadow: inset 0 0 0 2px var(--gold), 0 0 10px rgba(232,192,96,0.4); }
#vip-card { position: absolute; top: 58px; left: 352px; display: flex; gap: 8px; align-items: center; background: rgba(40, 10, 50, 0.85); border: 1px solid #c890ff; border-radius: 8px; padding: 6px 12px; cursor: pointer; min-width: 190px; }
#vip-card > span { font-size: 26px; }
#vip-card .vn { font-family: var(--title); color: #f0d8ff; font-size: 14px; }
#vip-card .vs { font-size: 12px; color: var(--muted); }
#vip-card .hpbar { width: 130px; }
#story { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 560px; max-width: 92vw; background: linear-gradient(180deg, rgba(40,20,50,0.97), rgba(20,10,25,0.97)); border: 2px solid #c890ff; border-radius: 12px; padding: 24px 28px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.8); animation: fadeIn 0.6s; z-index: 15; }
#story .st-crown { font-size: 46px; }
#story .st-title { font-family: var(--deco); font-size: 28px; color: #f0d8ff; margin: 4px 0 12px; }
#story .st-text { font-family: var(--title); font-size: 17px; line-height: 1.55; color: var(--ink); }
#story .st-rule { margin: 14px 0; color: #ff9a8a; font-weight: 700; }
#story .mbtn { margin-top: 10px; text-align: center; }
#place-tools { position: absolute; top: 96px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; color: var(--gold2); }
#place-tools .hbtn { font-size: 20px; padding: 2px 12px; }
.letterbox { position: absolute; inset: 0; pointer-events: none !important; }
.letterbox div { position: absolute; left: 0; right: 0; height: 0; background: #000; transition: height 1.6s ease; }
.letterbox div:first-child { top: 0; } .letterbox div:last-child { bottom: 0; }
.letterbox.on div { height: 11vh; }
.flash { position: absolute; inset: 0; background: #fff; pointer-events: none !important; animation: flashA 0.7s ease-out forwards; }
@keyframes flashA { 0% { opacity: 0.9; } 100% { opacity: 0; } }
.intro-title .logo-main { text-shadow: 0 0 30px rgba(255, 120, 40, 0.9), 0 4px 0 #3a1a08; animation: glow 2.5s ease-in-out infinite alternate; }
.logo-tag { font-family: var(--title); color: #ffd8b0; font-size: 22px; letter-spacing: 3px; margin-top: 6px; text-shadow: 0 2px 10px #000; }
@keyframes glow { from { filter: brightness(1); } to { filter: brightness(1.35); } }
#subtitles { bottom: 13vh; }

#queuepanel { position: absolute; right: 10px; bottom: 200px; width: 420px; max-height: 46vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.55); }
#queuepanel .qh { font-family: var(--title); color: var(--gold); margin-bottom: 6px; display: flex; justify-content: space-between; gap: 8px; }
#queuepanel .qh span { font-family: var(--ui); color: var(--muted); font-size: 13px; }
.qrow { display: flex; gap: 8px; align-items: center; padding: 5px 4px; border-top: 1px solid rgba(232,192,96,0.12); }
.qrow .qn { width: 18px; color: var(--muted); text-align: center; }
.qrow .qic { font-size: 24px; }
.qrow .qmid { flex: 1; font-size: 13px; }
.qrow .qbar2 { width: 100%; margin: 3px 0; }
.qrow .qmeta { color: var(--muted); font-size: 12px; }
.qs { font-size: 12px; color: var(--muted); margin-left: 6px; }
.qs.ok { color: var(--ok); } .qs.warn { color: var(--warn); }

#bossbar { position: absolute; top: 118px; left: 50%; transform: translateX(-50%); width: min(520px, 70vw); text-align: center; pointer-events: none; }
#bossbar .bn { font-family: var(--title); color: #e8c0ff; font-size: 20px; text-shadow: 0 0 10px #8a30ff, 0 2px 4px #000; letter-spacing: 2px; }
#bossbar .bb { height: 12px; margin-top: 4px; background: rgba(0,0,0,0.65); border: 1px solid #8a5ab8; border-radius: 6px; overflow: hidden; box-shadow: 0 0 14px rgba(138,48,255,0.5); }
#bossbar .bb > div { height: 100%; background: linear-gradient(90deg, #5a0e8a, #c040ff); transition: width 0.25s; }

.skip-btn { z-index: 50; bottom: 70px; font-size: 17px; padding: 10px 20px; background: rgba(0,0,0,0.7); }
#load-text .mbtn + .mbtn { margin-left: 12px; }

.st-power { margin: 10px 0 4px; color: #ffe28a; font-size: 15px; text-shadow: 0 0 8px rgba(255,200,80,0.4); }

.resimg { width: 24px; height: 24px; vertical-align: middle; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.7)); }
.cost .resimg, .qmeta .resimg, .mo .resimg, .sel-sub .resimg, .pa .resimg, .pc .resimg { width: 16px; height: 16px; margin-right: 2px; }
.ci .resimg { width: 22px; height: 22px; }
.ri { display: flex; align-items: center; }
.rcol { display: flex; flex-direction: column; line-height: 1.05; }
.rw { font-size: 10px; color: #c8e0a8; opacity: 0.95; }
.rw.zero { color: #8a8070; opacity: 0.6; }
#prodq { position: absolute; left: 10px; top: 180px; width: 190px; background: rgba(20,14,8,0.78); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
#prodq .pqh { font-family: var(--title); color: var(--gold); font-size: 13px; margin-bottom: 4px; }
.pq { display: flex; align-items: center; gap: 5px; padding: 3px 0; cursor: pointer; }
.pq:hover { background: rgba(232,192,96,0.08); }
.pq .pqb { font-size: 15px; } .pq .pqi { font-size: 17px; }
.pq .pqbar { flex: 1; height: 7px; background: rgba(0,0,0,0.5); border-radius: 4px; overflow: hidden; }
.pq .pqbar > div { height: 100%; background: linear-gradient(90deg, #4a8ad0, #8ac8ff); }
.pq .pqn { font-size: 11px; color: var(--muted); }
.pfree { color: #ffd070; } .pfull { color: #9ad890; }
.grpn { color: #8ac8ff; font-size: 0.85em; }
#tooltip { max-width: 330px; white-space: normal; overflow-wrap: anywhere; }
#tooltip .cost.lack, #tooltip span { white-space: normal; }

.vip-death { position: absolute; left: 0; right: 0; top: 30%; text-align: center; opacity: 0; transition: opacity 2s; pointer-events: none; }
.vip-death.on { opacity: 1; }
.vip-death .vd1 { font-family: var(--title); font-size: 44px; color: #f0d8a0; text-shadow: 0 0 18px rgba(120,0,0,0.9), 0 3px 6px #000; letter-spacing: 2px; }
.vip-death .vd2 { margin-top: 10px; font-size: 20px; color: #d8c8b0; font-style: italic; text-shadow: 0 2px 4px #000; }
.cine { opacity: 0; transition: opacity 0.8s; pointer-events: none; }

.devmode { display: block; margin: 6px 0 2px; font-size: 12px; color: var(--muted); cursor: pointer; opacity: 0.8; }
.devmode input { vertical-align: middle; margin-right: 4px; }
.devmode span { font-size: 11px; opacity: 0.8; }
#devages { position: absolute; right: 12px; top: 56px; z-index: 20; display: flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 8px; background: rgba(20, 14, 6, 0.88); border: 1px solid #ffb040; font-size: 13px; color: #ffb040; font-weight: 700; }
#devages button { min-width: 30px; padding: 3px 6px; border-radius: 5px; border: 1px solid rgba(255, 176, 64, 0.5); background: rgba(255, 176, 64, 0.08); color: #f0e0c0; font-weight: 700; cursor: pointer; }
#devages button:hover { background: rgba(255, 176, 64, 0.25); }
#devages button.on { background: #ffb040; color: #1a1208; }
.civ-unit .civ-uimg { display: block; width: 128px; height: 128px; margin: 6px auto 6px; object-fit: cover; border-radius: 8px; border: 2px solid #c8a050; box-shadow: 0 3px 10px rgba(0,0,0,0.6), inset 0 0 0 1px rgba(0,0,0,0.5); } /* portrait de l'unite unique, rendu d'apres son modele en jeu */
.devtag { margin-left: 6px; padding: 1px 5px; font-size: 10px; font-weight: 700; color: #1a1208; background: #ffb040; border-radius: 3px; align-self: center; }

#tuto { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); width: min(560px, 80vw); background: linear-gradient(180deg, rgba(48,34,16,0.96), rgba(28,20,10,0.96)); border: 2px solid var(--gold); border-radius: 10px; padding: 12px 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.6), 0 0 18px rgba(232,192,96,0.25); z-index: 30; }
#tuto.pop { animation: tuPop 0.35s ease-out; }
@keyframes tuPop { from { transform: translateX(-50%) scale(0.92); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
#tuto .tu-h { font-family: var(--title); color: var(--gold); font-size: 19px; margin-bottom: 6px; }
#tuto .tu-n { font-family: var(--ui); font-size: 12px; color: #1a1208; background: var(--gold); border-radius: 10px; padding: 1px 7px; margin-right: 6px; vertical-align: middle; }
#tuto .tu-t { color: #f0e6d0; font-size: 15px; line-height: 1.45; }
#tuto .tu-b { margin-top: 10px; display: flex; gap: 8px; justify-content: flex-end; }
#tip { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); width: min(520px, 80vw); background: linear-gradient(180deg, rgba(30,40,52,0.96), rgba(18,24,32,0.96)); border: 2px solid #8ab8e0; border-radius: 10px; padding: 12px 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.6), 0 0 18px rgba(138,184,224,0.25); z-index: 29; }
#tip.hidden, #tuto.hidden { display: none; }
#tip.pop { animation: tuPop 0.35s ease-out; }
#tip .tu-h { font-family: var(--title); color: #bfe0ff; font-size: 18px; margin-bottom: 6px; }
#tip .tu-t { color: #eef4fa; font-size: 15px; line-height: 1.45; }
#tip .tu-b { margin-top: 10px; display: flex; gap: 8px; justify-content: flex-end; }
.tip-hl { outline: 3px solid #8ab8e0 !important; outline-offset: 2px; animation: tuGlow 1s ease-in-out infinite alternate; position: relative; z-index: 5; }
.tu-arrow { position: absolute; z-index: 28; pointer-events: none; margin: -46px 0 0 -16px; width: 32px; text-align: center; font-size: 34px; line-height: 1; color: #ffd060; text-shadow: 0 0 8px rgba(0,0,0,0.9), 0 0 16px rgba(255,200,80,0.8); animation: tuBounce 0.8s ease-in-out infinite alternate; }
.tu-arrow.edge { margin: -16px 0 0 -16px; animation: none; }
@keyframes tuBounce { from { translate: 0 -10px; } to { translate: 0 0; } }
.tu-hl { outline: 3px solid #ffd060 !important; outline-offset: 2px; animation: tuGlow 1s ease-in-out infinite alternate; position: relative; z-index: 5; }
@keyframes tuGlow { from { box-shadow: 0 0 4px #ffd060; } to { box-shadow: 0 0 18px #ffb020; } }

.rank { color: #ffd040; text-shadow: 0 0 6px rgba(255,200,60,0.7); font-size: 0.9em; letter-spacing: 1px; }

/* taille d'origine, ecriture en gras pour la lisibilite */
.cl { font-size: 11.5px; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,0.9); }
#hud { font-weight: 600; }

/* fleche vers le personnage protege hors champ */
#vip-arrow { position: absolute; z-index: 30; width: 56px; height: 56px; margin: -28px 0 0 -28px; display: none; align-items: center; justify-content: center; cursor: pointer; pointer-events: auto; }
#vip-arrow .va-c { position: relative; width: 40px; height: 40px; border-radius: 50%; background: radial-gradient(circle, rgba(90,30,110,0.95), rgba(40,10,50,0.9)); border: 2px solid #ffd23c; box-shadow: 0 0 14px rgba(255,200,60,0.85); display: flex; align-items: center; justify-content: center; font-size: 22px; animation: vipPulse 1.2s ease-in-out infinite; }
#vip-arrow .va-pt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end; color: #ffd23c; font-size: 22px; text-shadow: 0 0 6px #000, 0 0 3px #000; pointer-events: none; }
@keyframes vipPulse { 50% { box-shadow: 0 0 24px rgba(255,210,80,1); transform: scale(1.08); } }

/* unites abritees dans un batiment : une icone par unite (clic : la faire sortir) */
.garr { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.garr .gu { position: relative; width: 30px; height: 30px; border-radius: 5px; background: rgba(0,0,0,0.45); border: 1px solid rgba(232,192,96,0.35); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 18px; }
.garr .gu:hover { border-color: #e8c060; background: rgba(60,40,10,0.6); }
.garr .gu.mil { border-color: #1e7bff; }
.garr .gu.vip { border-color: #ffd23c; box-shadow: 0 0 6px rgba(255,210,60,0.8); background: rgba(70,25,90,0.8); }
.garr .gu i { position: absolute; left: 2px; bottom: 2px; height: 3px; background: #6dff6d; border-radius: 1px; max-width: calc(100% - 4px); }

/* bouton de suppression d'unites */
.sel-del { margin-top: 6px; }
.sel-del .sbtn.danger { background: rgba(120, 20, 20, 0.7); border-color: #d05050; color: #ffe0e0; }
.sel-del .sbtn.danger.armed { background: #b01818; border-color: #ff8080; animation: delPulse 0.6s ease-in-out infinite alternate; }
@keyframes delPulse { to { box-shadow: 0 0 10px #ff4040; } }

/* consommation du village (nourriture mangee, bois de chauffage) */
.rc { display: block; font-size: 11px; line-height: 1.05; color: #ffb090; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-shadow: 0 1px 2px #000; }
.res.short { border-color: #ff5040; box-shadow: 0 0 8px rgba(255, 60, 40, 0.6); animation: shortBlink 1s ease-in-out infinite alternate; }
@keyframes shortBlink { to { background: rgba(120, 20, 10, 0.55); } }

/* messages dans le panneau d'ordres */
.cinfo { font-size: 13px; line-height: 1.35; padding: 6px 8px; margin-bottom: 6px; background: rgba(60, 30, 80, 0.55); border: 1px solid rgba(200, 144, 255, 0.5); border-radius: 6px; color: #f0e6ff; }
.cinfo.small { font-size: 12px; margin: 6px 0 0; background: rgba(0, 0, 0, 0.35); border-color: rgba(232, 192, 96, 0.3); color: var(--ink); }
#btn-rebuild { background: linear-gradient(180deg, #b07a2a, #6a4510); animation: blink 1.4s infinite; }
#btn-rebuild { width: auto; padding: 0 10px; white-space: nowrap; font-weight: bold; }   /* (20/11, T10) libelle « Tout reconstruire » */
#btn-rebuild .rb-lab { font-size: 13px; margin: 0 4px; }

/* icones peintes */
.gi { width: 1.55em; height: 1.55em; object-fit: contain; vertical-align: middle; pointer-events: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.6)); }
.ci .gi { width: 38px; height: 38px; }
.cbtn.unitbtn { height: 92px; gap: 1px; }
.cbtn.unitbtn .ci .gi { width: 64px; height: 64px; filter: none; } /* unites a former : grande icone sans halo */
.sel-icon .gi { width: 48px; height: 48px; }
.up-icon .gi { width: 42px; height: 42px; }
.tab .gi { width: 22px; height: 22px; margin-right: 2px; }
.hbtn .gi { width: 24px; height: 24px; }
.gi.clock { width: 28px; height: 28px; }
.gi.inl { width: 18px; height: 18px; }
.chip .gi, .mini .gi, .qi .gi, .pqb .gi, .pqi .gi, .qic .gi, .garr .gi { width: 24px; height: 24px; }
.gi.dim { filter: grayscale(1) brightness(0.55); }
.ci { position: relative; }
.ci .gi.lockb { position: absolute; width: 20px; height: 20px; right: -6px; bottom: -4px; }
.cbtn.locked .ci > .gi:first-child { filter: grayscale(1) brightness(0.5); }
.gplus { position: absolute; right: -4px; bottom: -4px; font-size: 15px; color: #7dff5a; text-shadow: 0 0 3px #000, 0 0 2px #000; }
.gplus.minus { color: #ff7a6a; }

/* bulles d'action au-dessus des batiments (eteindre, reparer, reconstruire) */
#worldtips { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
.wtip { position: absolute; transform: translate(-50%, -100%); pointer-events: auto; cursor: pointer; display: flex; flex-direction: column; align-items: center;
  font: 600 13px var(--body, sans-serif); color: #fff3d8; background: rgba(40, 24, 12, 0.88); border: 1px solid rgba(240, 200, 110, 0.75); border-radius: 9px;
  padding: 4px 10px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.55); white-space: nowrap; transition: transform 0.12s; }
.wtip:hover { transform: translate(-50%, -100%) scale(1.08); background: rgba(70, 40, 16, 0.95); }
.wtip::after { content: ""; position: absolute; bottom: -6px; left: 50%; margin-left: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: rgba(240, 200, 110, 0.75); }
.wtip small { font-weight: 400; font-size: 11px; opacity: 0.85; }
.wtip.fire { border-color: #ff7a30; background: rgba(110, 30, 10, 0.9); animation: wtipPulse 0.9s ease-in-out infinite alternate; }
.wtip.fireBusy { border-color: #60b0ff; background: rgba(20, 50, 90, 0.88); cursor: default; }
.wtip.repair { border-color: #8ad06a; }
@keyframes wtipPulse { from { box-shadow: 0 0 4px rgba(255, 100, 30, 0.5); } to { box-shadow: 0 0 16px rgba(255, 120, 30, 0.95); } }

/* ordres personnels du protege : cadre royal distinct, trois boutons de couleurs differentes */
.vipcmds { margin: 4px 0 6px; padding: 6px 6px 4px; border: 2px solid #e0b040; border-radius: 9px; background: linear-gradient(180deg, rgba(90, 30, 110, 0.85), rgba(50, 14, 64, 0.9)); box-shadow: 0 0 10px rgba(224, 176, 64, 0.35) inset; }
.vipcmds-t { font-family: var(--title); color: #ffd870; font-size: 13px; text-align: center; margin-bottom: 4px; letter-spacing: 0.5px; }
.vipgrid { grid-template-columns: repeat(3, 1fr) !important; }
.vipgrid .vip-stay { border-color: #e05040 !important; background: linear-gradient(180deg, #6a1e18, #3a0e0a) !important; }
.vipgrid .vip-shelter { border-color: #4a8ae0 !important; background: linear-gradient(180deg, #1c3a6a, #0e1e3a) !important; }
.vipgrid .vip-coach { border-color: #e0b040 !important; background: linear-gradient(180deg, #6a5014, #3a2a08) !important; }

/* actions sur le batiment (ralliement, demolir) : petits boutons a part, colores */
.btools { display: flex; gap: 6px; justify-content: flex-end; margin-top: 6px; }
.btools .cbtn, .btools button { width: auto !important; min-width: 0 !important; height: 30px !important; min-height: 0 !important; padding: 2px 8px !important; font-size: 11px !important; flex-direction: row !important; gap: 4px; }
.btools .gi, .btools img { width: 18px !important; height: 18px !important; }
.btools .bt-rally { background: linear-gradient(180deg, #2a5a3a, #163a24) !important; border-color: #6ad08a !important; }
.btools .bt-demol { background: linear-gradient(180deg, #6a1a14, #3a0c08) !important; border-color: #ff6a50 !important; }
.btools .ci { font-size: 15px !important; line-height: 1 !important; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; }   /* (14/11, « la cle Desassembler sort du cadre ») emoji a la taille des icones du rang d outils */
.btools .bt-desass { background: linear-gradient(180deg, #4a4a52, #2a2a30) !important; border-color: #b8b8c8 !important; }
/* bulles plus discretes */
.wtip.rebuild, .wtip.repair, .wtip.repairBusy { font-size: 11px; padding: 2px 7px; border-radius: 7px; }
.wtip.repairBusy { border-color: #8ad06a; background: rgba(20, 60, 30, 0.85); cursor: default; }

/* marche : tableau des cours */
.market { margin: 4px 0; padding: 6px; border: 1px solid rgba(232, 192, 96, 0.35); border-radius: 8px; background: rgba(30, 20, 10, 0.55); font-size: 12px; }
.mk-h, .mk-row { display: grid; grid-template-columns: 1.6fr 0.8fr 1fr 0.9fr 0.9fr; gap: 4px; align-items: center; }
.mk-h { color: var(--gold); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.4px; padding: 0 2px 3px; border-bottom: 1px solid rgba(232, 192, 96, 0.25); }
.mk-row { padding: 3px 2px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.mk-r { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.mk-r .resimg, .mk-b .resimg { width: 16px; height: 16px; vertical-align: -3px; }
.mk-b { font: inherit; font-size: 11px; line-height: 1.1; padding: 3px 4px; border-radius: 6px; cursor: pointer; color: #fff; border: 1px solid; }
.mk-b small { font-size: 10px; opacity: 0.95; }
.mk-b.sell { background: linear-gradient(180deg, #6a4a14, #3a2808); border-color: #e0b040; }
.mk-b.buy { background: linear-gradient(180deg, #1c4a6a, #0e2a3e); border-color: #5ab0e8; }
.mk-b:disabled { opacity: 0.4; cursor: default; }
.mk-row i { font-style: normal; font-size: 9px; }
.mk-row i.up { color: #ff7a5a; } .mk-row i.dn { color: #6ad08a; } .mk-row i.eq { color: #a8a8a8; }
.mk-f { margin-top: 5px; font-size: 10.5px; opacity: 0.8; }

/* credits : signature de l'auteur, en grand, en gras et en couleurs */
.credit-by { font-size: 64px; font-weight: 900; text-align: center; margin: 40px 10px 34px; letter-spacing: 2px;
  background: linear-gradient(90deg, #ffd23a, #ff7a28, #e8306a, #8a5cff, #3ec8ff); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.7)); }

/* ---------------------------------------------------------------- final : objectifs, decollage, victoire */
.obj.fin { font-weight: 600; }
.obj.fin.done { color: #9ae890; }
.vipcmds .vip-barge, .vipcmds .vip-rocket { border-color: #ffd23a !important; box-shadow: 0 0 10px rgba(255, 210, 60, 0.55); animation: vipPulse 1.4s ease-in-out infinite; }
@keyframes vipPulse { 50% { box-shadow: 0 0 22px rgba(255, 210, 60, 0.95); } }
.devwave select { background: #2a2018; color: #f0e0c0; border: 1px solid #8a6a3a; border-radius: 6px; padding: 4px 8px; font-size: 14px; }
.devwave.hidden { display: none; }
.launch-count { position: absolute; left: 50%; top: 32%; transform: translate(-50%, -50%); font-size: 120px; font-weight: 900; color: #fff4d8;
  text-shadow: 0 0 30px rgba(255, 160, 60, 0.9), 0 4px 10px #000; pointer-events: none; letter-spacing: 4px; transition: opacity 1.5s; font-family: Georgia, serif; white-space: nowrap; }
.launch-count.pop { animation: lcPop 0.9s ease-out; }
.launch-count.fade { opacity: 0; }
@keyframes lcPop { 0% { transform: translate(-50%, -50%) scale(1.6); opacity: 0; } 30% { opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1); } }
.launch-cap { position: absolute; left: 50%; bottom: 16%; transform: translateX(-50%); font-size: 22px; color: #f0e8d8; text-shadow: 0 2px 6px #000; pointer-events: none; font-style: italic; text-align: center; }
.launch-fade { position: absolute; inset: 0; background: #fff; opacity: 0; transition: opacity 2.4s; pointer-events: none; z-index: 50; }
.launch-fade.black { background: #000; }
.launch-fade.on { opacity: 1; }
.panel.victory { text-align: center; }
.panel.victory h1 { font-size: 54px; background: linear-gradient(90deg, #ffd23a, #ff7a28, #e8306a, #8a5cff, #3ec8ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.vic-rocket { font-size: 72px; animation: vicUp 3s ease-in-out infinite; }
@keyframes vicUp { 50% { transform: translateY(-12px); } }
.credit-by.small { font-size: 30px; margin: 14px 0; }
.credit-dev { font-size: 15px; text-align: center; margin: -22px 10px 26px; letter-spacing: 1px; opacity: 0.8; }

/* barre des ressources : cases larges, vignette carree, nom de la ressource bien lisible */
#res-list { gap: 5px; }
.res { min-width: 112px; padding: 3px 8px 3px 4px; gap: 7px; border-left: 3px solid var(--rc, #e8c060); background: linear-gradient(90deg, rgba(0,0,0,0.5), rgba(0,0,0,0.3)); }
.res .rsq { width: 34px; height: 34px; border-radius: 6px; overflow: hidden; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.6), 0 1px 3px rgba(0,0,0,0.6); }
.res .rsq img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.42); display: block; }
.res .rcol { display: flex; flex-direction: column; line-height: 1.05; }
.res .rn { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px; color: var(--rc, #e8c060); text-shadow: 0 1px 2px #000; }
.res .rline { display: flex; align-items: baseline; gap: 6px; }
.res .rv { font-size: 16px; }
.res .rw { font-size: 11px; opacity: 0.8; }
@media (max-width: 1400px) { .res { min-width: 96px; } .res .rsq { width: 28px; height: 28px; } }

.garr-detail { font-size: 12px; color: #e8dcc0; margin: 3px 0; }
.garr-detail.atk { color: #ffd890; font-weight: 700; }
.garr-detail i { color: #c8e0a8; font-weight: 400; }

/* ---- onglet Sauvegarder / Charger ---- */
.panel.saves { width: 720px; }
.sv-list { display: flex; flex-direction: column; gap: 12px; }
.sv-card { display: flex; align-items: center; gap: 16px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(0, 0, 0, 0.28); }
.sv-card.cur { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 18px rgba(232, 192, 96, 0.18); }
.sv-card.free { opacity: 0.8; }
.sv-pic { flex: 0 0 192px; height: 108px; border-radius: 5px; overflow: hidden; background: rgba(0, 0, 0, 0.45); border: 1px solid rgba(232, 192, 96, 0.2); }
.sv-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sv-empty { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 34px; color: var(--muted); }
.sv-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sv-title { font-family: var(--title); color: var(--gold); font-size: 19px; letter-spacing: 1px; }
.sv-badge { font-family: var(--ui); font-size: 11px; color: #1a1208; background: var(--gold); border-radius: 10px; padding: 2px 8px; margin-left: 6px; vertical-align: middle; letter-spacing: 0; }
.sv-line { font-size: 15px; color: var(--ink); }
.sv-free { color: var(--muted); font-style: italic; }
.sv-date { font-size: 13px; color: var(--muted); }
.sv-acts { display: flex; flex-direction: column; gap: 6px; flex: 0 0 auto; }
.sv-acts .mbtn.small { margin-top: 0; text-align: center; min-width: 150px; }
.sv-acts .mbtn.danger { min-width: 0; }
.mbtn.danger:hover { border-color: #d05040; background: linear-gradient(180deg, rgba(120, 40, 30, 0.9), rgba(60, 18, 12, 0.95)); }
.mbtn.armed { border-color: #e06040; background: linear-gradient(180deg, #a83a28, #5a1a10); color: #fff; }
.mbtn[disabled] { opacity: 0.4; cursor: not-allowed; transform: none; }
.sv-warn { color: #f0a070; margin-bottom: 12px; }
.sv-msg { color: #a8e090; margin-bottom: 12px; font-size: 15px; }
.sv-msg.hidden { display: none; }
@media (max-width: 760px) { .sv-card { flex-wrap: wrap; } .sv-pic { flex-basis: 100%; height: 140px; } .sv-acts { flex-direction: row; flex-wrap: wrap; } }
.sv-sub { color: var(--muted); margin: -8px 0 14px; font-size: 15px; }
.sv-acts .mbtn.primary { text-align: center; min-width: 170px; }
.sv-acts .mbtn small { font-size: 11px; }
.sv-slot { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.sv-name { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sv-name label { color: var(--gold2); font-size: 15px; white-space: nowrap; }
.sv-name input { flex: 1; min-width: 0; font: inherit; font-size: 16px; color: var(--ink); background: rgba(0, 0, 0, 0.4); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; outline: none; }
.sv-name input:focus { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(232, 192, 96, 0.2); }

/* narration (intro, cinematiques) : lettres noires sur un bandeau clair, bien lisibles sur tous les fonds */
#subtitles, .launch-cap {
  color: #111 !important; text-shadow: none !important; font-style: normal !important;
  background: linear-gradient(180deg, rgba(250, 244, 230, 0.94), rgba(232, 222, 200, 0.94)) !important;
  border: 1px solid rgba(120, 96, 60, 0.75); border-radius: 10px; box-shadow: 0 6px 22px rgba(0, 0, 0, 0.55);
  padding: 10px 26px !important; font-weight: 600;
}
#subtitles:empty, .launch-cap:empty { display: none; }
.launch-cap { max-width: min(900px, 86vw); }
.launch-cap.joy { color: #111 !important; animation: none; }
/* menu pause ouvert : aucune bulle d'information par-dessus */
body.ui-paused #worldtips, body.ui-paused #tip, body.ui-paused #overlay2d, body.ui-paused #tooltip, body.ui-paused .tooltip, body.ui-paused #notifs, body.ui-paused .notif { display: none !important; }
/* un message (histoire, arrivee) est ouvert : les bulles de la carte ne passent pas par-dessus */
body:has(#story:not(.hidden)) #worldtips, body:has(#story:not(.hidden)) #tip { display: none !important; }
/* bouton du mode bac a sable : arc-en-ciel anime */
.mbtn.rainbow { background: linear-gradient(90deg, #e83a3a, #f0a030, #e8d030, #40c060, #3a8ae0, #9a4ae0, #e83a3a); background-size: 300% 100%; color: #fff; text-shadow: 0 1px 3px #000; border-color: #fff8; animation: rainbowMove 6s linear infinite; font-weight: 700; }
.mbtn.rainbow:hover { filter: brightness(1.15); }
@keyframes rainbowMove { from { background-position: 0% 0; } to { background-position: 300% 0; } }
.mbtn.locked { opacity: 0.45; cursor: not-allowed; }
/* les panneaux de l'interface passent devant les bulles posees sur la carte */
#cmdpanel, #selpanel, #minimap-wrap, #objectives, #queuepanel, #devunits, #devages, #merchant, #res-list, #clock, #bossbar { z-index: 8; }
/* cinematiques : aucune bulle sur la carte */
body:has(#hud.cine) #worldtips, body:has(.letterbox) #worldtips, #hud.cine #tip { display: none !important; }
/* objectif suivant mis en avant ; bouton « Lancer la nuit » */
.obj.next { color: #ffe08a; font-weight: 700; text-shadow: 0 0 8px rgba(255, 200, 80, 0.45); }
#clock { position: relative; }
#btn-night { position: fixed; top: 58px; right: 12px; left: auto; padding: 4px 10px; font-size: 13px; pointer-events: auto; white-space: nowrap; z-index: 9; }
#btn-night.hidden { display: none; }

/* credits : onglets et projection de la compilation des cinematiques */
.panel.credits { max-width: min(1100px, 94vw); }
.credit-tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 10px; }
.credit-page.hidden { display: none; }
/* credits : bibliotheques et polices tierces, textes complets des licences */
.credit-libs { text-align: center; font-size: 15px; opacity: 0.85; margin: 0 20px 18px; line-height: 1.5; }
.credit-libs p { margin: 4px 0; }
.credit-lic { max-height: 56vh; overflow: auto; text-align: left; font-size: 12.5px; line-height: 1.45; white-space: pre-wrap; background: rgba(0,0,0,0.35); padding: 14px 18px; border-radius: 8px; margin: 0 6px 12px; }
.film-box { background: #000; border: 2px solid #8a6a30; border-radius: 10px; overflow: hidden; box-shadow: 0 0 40px rgba(232, 192, 112, 0.25); }
.film-box video { display: block; width: 100%; max-height: 62vh; background: #000; }
.film-legend { text-align: center; font-style: italic; opacity: 0.85; margin: 10px 0 4px; }

/* atelier du protege (ui/vip_creator.js) */
#vipcreator { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.68); }
#vipcreator .vc-panel { width: min(1080px, 96vw); height: min(720px, 94vh); display: flex; flex-direction: column; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.75); overflow: hidden; }
#vipcreator .vc-head { padding: 16px 24px 10px; border-bottom: 1px solid var(--line); }
#vipcreator h2 { font-family: var(--title); color: var(--gold); margin: 0 0 4px; font-size: 28px; letter-spacing: 1px; }
#vipcreator .vc-sub { color: var(--muted); font-size: 15px; }
#vipcreator .vc-sub b { color: var(--gold2); }
#vipcreator .vc-body { flex: 1; display: flex; min-height: 0; }
#vipcreator .vc-view { position: relative; width: 38%; min-width: 260px; background: radial-gradient(ellipse at 50% 40%, rgba(120, 90, 50, 0.35), rgba(0, 0, 0, 0.2) 70%); border-right: 1px solid var(--line); }
#vipcreator .vc-view canvas { width: 100%; height: 100%; display: block; cursor: grab; }
#vipcreator .vc-hint { position: absolute; bottom: 10px; width: 100%; text-align: center; color: var(--muted); font-size: 13px; pointer-events: none; }
#vipcreator .vc-opts { flex: 1; overflow-y: auto; padding: 10px 20px 16px; }
#vipcreator .vc-sec h3 { font-family: var(--title); color: var(--gold2); font-size: 17px; margin: 12px 0 6px; border-bottom: 1px solid rgba(232, 192, 96, 0.18); padding-bottom: 3px; }
#vipcreator .vc-row { display: flex; align-items: flex-start; gap: 10px; margin: 5px 0; }
#vipcreator .vc-lab { width: 150px; flex: none; color: var(--ink); font-size: 15px; padding-top: 5px; }
#vipcreator .vc-chips { display: flex; flex-wrap: wrap; gap: 5px; }
#vipcreator .vc-chip { font-family: var(--ui); font-size: 14px; color: var(--ink); cursor: pointer; padding: 4px 10px; border-radius: 14px; border: 1px solid rgba(232, 192, 96, 0.25); background: rgba(40, 30, 18, 0.8); display: inline-flex; align-items: center; gap: 6px; }
#vipcreator .vc-chip:hover { border-color: var(--gold); }
#vipcreator .vc-chip.on { background: linear-gradient(180deg, #a8782e, #6a4616); border-color: var(--gold); color: #fff6dd; }
#vipcreator .vc-chip i { width: 13px; height: 13px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.6); display: inline-block; }
#vipcreator .vc-foot { display: flex; gap: 10px; justify-content: flex-end; align-items: center; padding: 10px 20px 14px; border-top: 1px solid var(--line); }
#vipcreator .vc-foot .mbtn.small { margin-top: 0; }
@media (max-width: 760px) { #vipcreator .vc-body { flex-direction: column; } #vipcreator .vc-view { width: 100%; height: 40%; border-right: none; border-bottom: 1px solid var(--line); } #vipcreator .vc-lab { width: 100px; } }

/* garnison : fiches illustrees (portrait, nom, vie, grade, morts abattus) */
.garr-band { display: flex; align-items: center; gap: 6px; margin: 6px 0 4px; padding: 4px 8px; border-radius: 6px; font-weight: 700; font-size: 14px; color: #ffe8a8;
  background: linear-gradient(90deg, rgba(120,80,20,0.75), rgba(40,26,8,0.5)); border: 1px solid rgba(255,210,110,0.55); }
.garr-band b { font-size: 18px; color: #fff4c8; } .garr-band small { color: #d8c08a; margin-right: auto; }
.garr { gap: 6px; max-height: 260px; overflow-y: auto; }
.garr .gu { width: 74px; height: auto; min-height: 92px; flex-direction: column; justify-content: flex-start; padding: 4px 2px 3px; gap: 2px;
  background: linear-gradient(180deg, rgba(40,34,24,0.9), rgba(14,12,10,0.92)); border: 1px solid rgba(232,192,96,0.5); box-shadow: 0 2px 6px rgba(0,0,0,0.5); }
.garr .gu .gp { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; font-size: 34px; border-radius: 6px; background: radial-gradient(circle, rgba(255,240,200,0.18), rgba(0,0,0,0)); }
.garr .gu .gp .gi { width: 48px; height: 48px; }
.garr .gu .gn { font-size: 10px; line-height: 1.1; color: #f2e6c8; text-align: center; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.garr .gu .gv { position: relative; width: 62px; height: 5px; background: rgba(0,0,0,0.6); border-radius: 2px; overflow: hidden; }
.garr .gu .gv i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; }
.garr .gu .gs { font-size: 9px; color: #d8cfb8; }
.garr .gu.mil { border-color: #3d8bff; } .garr .gu.vip { border-color: #ffd23c; }

/* panneaux d'achat (batiments, unites, ameliorations) agrandis : lisibles d'un coup d'oeil */
#cmdpanel { width: 580px; padding: 12px; }
#cmdpanel .tab { font-size: 17px; padding: 7px; }
#cmdpanel .cgrid { gap: 7px; }
#cmdpanel .cbtn { height: 104px; gap: 5px; }
#cmdpanel .ci { font-size: 40px; }
#cmdpanel .ci .gi:not(.lockb) { width: 54px; height: 54px; }
#cmdpanel .cbtn.unitbtn .ci .gi:not(.lockb) { width: 76px; height: 76px; }
#cmdpanel .cbtn.unitbtn { height: 118px; }
#cmdpanel .cl { font-size: 14px; font-weight: 600; }
#tooltip { max-width: 360px; font-size: 16px; }
/* options : le contenu defile, les boutons Retour / Reinitialiser restent toujours visibles en bas */
.panel.options { display: flex; flex-direction: column; overflow: hidden; }
.panel.options #opt-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 6px; }
.panel.options .row-btns { flex: 0 0 auto; padding-top: 10px; border-top: 1px solid var(--line); }

/* voile pendant la compilation des shaders d'une nouvelle carte */
#warm-veil { position: fixed; inset: 0; z-index: 900; display: none; align-items: center; justify-content: center; background: rgba(11, 9, 7, 0.985); }   /* (20/11) presque opaque : l'interface dessous est dessinee pendant le voile (sinon gel d'1 s a son apparition) */
#warm-veil.on { display: flex; }
#warm-veil .wv-box { margin-bottom: 9vh; display: flex; gap: 14px; align-items: center; padding: 12px 22px; border-radius: 10px; background: rgba(10, 8, 6, 0.78); color: #f2e6c8; font: 600 18px Georgia, serif; border: 1px solid rgba(232, 192, 112, 0.5); }
#warm-veil .wv-spin { width: 20px; height: 20px; border-radius: 50%; border: 3px solid rgba(232, 192, 112, 0.25); border-top-color: #e8c070; animation: wvspin 0.9s linear infinite; }
@keyframes wvspin { to { transform: rotate(360deg); } }

/* protege menace : la fleche hors champ rougit et pulse */
#vip-arrow.danger .va-pt { color: #ff3a24; text-shadow: 0 0 10px rgba(255, 40, 20, 0.9); }
#vip-arrow.danger .va-c { animation: vipDanger 0.7s ease-in-out infinite alternate; }
@keyframes vipDanger { from { transform: scale(1); filter: drop-shadow(0 0 2px #f00); } to { transform: scale(1.25); filter: drop-shadow(0 0 10px #f22); } }

/* mode « Deux rives » : rive aux commandes et dons a l'autre village */
#rive-badge { position: relative; display: flex; align-items: center; gap: 6px; margin-left: 8px; }
#rive-badge button { font: inherit; font-size: 13px; padding: 4px 10px; border-radius: 5px; border: 1px solid rgba(232, 192, 96, 0.45); background: rgba(0, 0, 0, 0.45); color: #f0e0c0; cursor: pointer; white-space: nowrap; }
#rive-badge .rv-switch { border-color: #6ab0ff; color: #cfe6ff; }
#rive-badge.east .rv-switch { border-color: #ffb060; color: #ffe2c0; }
#rive-badge .rv-switch span { opacity: 0.7; margin-left: 4px; }
#rive-badge button:hover { background: rgba(232, 192, 96, 0.18); }
#rive-badge .rv-pop { position: absolute; top: 34px; left: 0; z-index: 30; min-width: 280px; padding: 8px 10px; border-radius: 8px; background: rgba(20, 14, 6, 0.94); border: 1px solid rgba(232, 192, 96, 0.5); }
#rive-badge .rv-pop.hidden { display: none; }
#rive-badge .rv-t { font-weight: 700; color: #e8c070; margin-bottom: 6px; }
#rive-badge .rv-r { display: grid; grid-template-columns: 1fr 52px auto auto; gap: 6px; align-items: center; padding: 2px 0; font-size: 13px; }
#rive-badge .rv-r button { padding: 2px 7px; font-size: 12px; }
/* onglet Multijoueur : en-tete, cartes de choix (icone doree, titre, explication) */
.panel.multi { max-width: 560px; }
.panel.multi .mp-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.panel.multi .mp-head h2 { margin: 0; }
.panel.multi .mp-ico .mi { width: 44px; height: 44px; color: #e8c070; }
.panel.multi .mp-sub { color: #c8b08a; font-style: italic; font-size: 14px; margin-top: 2px; }
.panel.multi .mp-intro { margin: 0 0 16px; line-height: 1.45; color: #e6dcc6; font-size: 14.5px; }
.panel.multi .mp-cards { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.panel.multi .mp-card { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 14px; text-align: left; cursor: pointer;
  font: inherit; color: #f2ead8; background: linear-gradient(180deg, rgba(60, 42, 20, 0.85), rgba(32, 22, 10, 0.9));
  border: 1px solid rgba(232, 192, 96, 0.35); border-radius: 10px; transition: border-color 0.15s, transform 0.15s, background 0.15s; }
.panel.multi .mp-card:hover:not(:disabled) { border-color: #e8c070; transform: translateY(-1px); background: linear-gradient(180deg, rgba(84, 58, 24, 0.9), rgba(40, 27, 12, 0.92)); }
.panel.multi .mp-card:disabled { opacity: 0.45; cursor: default; }
.panel.multi .mp-ci { flex: 0 0 auto; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(232, 192, 96, 0.45); background: rgba(0, 0, 0, 0.3); }
.panel.multi .mp-ci .mi { width: 28px; height: 28px; color: #e8c070; margin: 0; }
.panel.multi .mp-ct { display: flex; flex-direction: column; gap: 3px; }
.panel.multi .mp-ct b { font-family: 'Cinzel', Georgia, serif; font-size: 16px; color: #f0d090; letter-spacing: 0.5px; }
.panel.multi .mp-ct small { font-size: 13px; color: #cbbd9f; line-height: 1.3; }
#rive-badge .mi { width: 16px; height: 16px; vertical-align: -3px; margin-right: 5px; }

/* ecrans Heberger / Rejoindre : etapes numerotees, codes a copier */
.panel.multi.net .net-step { display: flex; align-items: center; gap: 12px; margin: 12px 0 6px; transition: opacity 0.2s; }
.panel.multi.net .net-step.dim2 { opacity: 0.45; }
.panel.multi.net .net-step b { display: block; color: #f0d090; font-family: 'Cinzel', Georgia, serif; font-size: 15px; }
.panel.multi.net .net-step small { color: #cbbd9f; font-size: 12.5px; }
.panel.multi.net .net-n { flex: 0 0 auto; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1px solid #e8c070; color: #e8c070; font-weight: 700; }
.panel.multi.net textarea { width: 100%; box-sizing: border-box; height: 70px; resize: none; padding: 8px; border-radius: 8px; border: 1px solid rgba(232, 192, 96, 0.4);
  background: rgba(0, 0, 0, 0.45); color: #f2ead8; font: 11px/1.35 Consolas, monospace; word-break: break-all; }
.panel.multi.net .net-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.panel.multi.net .net-ok { color: #9ad08a; font-size: 13px; }
.panel.multi.net .net-diag { margin: 6px 0 2px; font-size: 13px; line-height: 1.35; color: #cfc4a8; }
.panel.multi.net .net-diag.bon { color: #9ed39a; }
.panel.multi.net .net-diag.moyen { color: #e8c060; }
.panel.multi.net .net-diag.mauvais { color: #ff9a80; }
.panel.multi.net .net-status { min-height: 20px; margin: 10px 0 4px; color: #e6dcc6; font-size: 13.5px; font-style: italic; }
.panel.multi.net .net-status.bad { color: #ff9a80; }

/* (22/10) mini-videos du petit garcon de 1919 : fondu au noir, texte en grand et en gras, video plein ecran */
.garcon { position: fixed; inset: 0; z-index: 2000; pointer-events: auto; background: #000; opacity: 0; transition: opacity 1.1s ease; display: flex; align-items: center; justify-content: center; }
.garcon.noir { opacity: 1; }
.garcon.direct { transition: none; }   /* (25/10) intro : noir tout de suite, le village ne se voit pas avant la video */
.garcon.sortie { opacity: 0; transition: opacity 0.8s ease; }
.garcon-texte { position: absolute; left: 8%; right: 8%; text-align: center; color: #f3e9d2; font-weight: 900; font-size: clamp(22px, 3.7vw, 64px);
  line-height: 1.25; letter-spacing: 0.01em; text-shadow: 0 0 28px rgba(255, 190, 110, 0.25); opacity: 0; transition: opacity 1.2s ease; font-family: Georgia, "Times New Roman", serif; }
.garcon-texte.on { opacity: 1; }
/* (28/10) cour d'ecole : le texte s'affiche par-dessus le noir de la video (sa melodie commence dessous), en Cinzel */
.garcon-texte.ecole { z-index: 1; font-family: var(--title); font-weight: 600; font-size: clamp(20px, 2.9vw, 52px); line-height: 1.45; }
.garcon-texte.ecole.grand { font-size: clamp(40px, 6.5vw, 120px); letter-spacing: 0.08em; }
.garcon-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; opacity: 0; transition: opacity 0.6s ease; }
.garcon-video.on { opacity: 1; }
.garcon-passer { z-index: 61; }

/* (25/10) info-bulle des commandes de la moto lunaire (6 s) */
#bulle-commandes { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); background: rgba(15, 12, 8, 0.88); border: 1px solid var(--gold); border-radius: 8px; padding: 10px 18px; color: #f2e6cc; font-size: 16px; text-align: center; pointer-events: none; z-index: 40; animation: slideIn 0.3s; transition: opacity 0.7s; box-shadow: 0 4px 18px rgba(0,0,0,0.5); }
#bulle-commandes.fade { opacity: 0; }
/* (08/11) proposition d'avance rapide de nuit */
#propose-nuit { position: absolute; left: 50%; top: 16%; transform: translateX(-50%); background: rgba(15, 12, 8, 0.92); border: 1px solid var(--gold); border-radius: 8px; padding: 12px 20px; color: #f2e6cc; font-size: 16px; text-align: center; z-index: 45; animation: slideIn 0.3s; box-shadow: 0 4px 18px rgba(0,0,0,0.5); }
#propose-nuit .pn-b { display: flex; gap: 10px; justify-content: center; margin-top: 10px; }
#bulle-commandes .bc-l { margin-top: 6px; }
#bulle-commandes kbd { display: inline-block; min-width: 22px; padding: 1px 6px; margin: 0 3px 0 8px; border: 1px solid #c8a85a; border-bottom-width: 3px; border-radius: 4px; background: #2a2218; color: #ffe9b0; font-family: inherit; font-size: 14px; }
body.ui-paused #bulle-commandes { display: none !important; }

/* (06/11) multijoueur : bandeau de pause quand l'autre joueur est dans un menu */
.net-pause { position: absolute; left: 50%; top: 92px; transform: translateX(-50%); z-index: 30; padding: 10px 22px; background: rgba(10,12,20,.88); border: 1px solid var(--gold); border-radius: 8px; color: var(--gold2); font-family: var(--title); font-size: 18px; letter-spacing: 1px; pointer-events: none; }

/* (06/11) mini-carte en losange : boutons de ce qu'elle montre, dans les coins libres */
.mm-filtre { position: absolute; width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 1px solid var(--gold); background: rgba(10,12,20,.85); color: #fff; font-size: 13px; line-height: 22px; cursor: pointer; z-index: 3; }
.mm-filtre:hover { background: var(--gold); }
.mm-filtre.off { opacity: .45; filter: grayscale(1); border-color: #666; }
.mm-filtre[data-f="unites"] { left: 9px; top: 9px; }
.mm-filtre[data-f="batiments"] { left: 9px; bottom: 9px; }
.mm-filtre[data-f="ressources"] { right: 9px; bottom: 9px; }
#mm-grand, #mm-leg { z-index: 3; }

/* (06/11) liste des ressources a afficher sur la mini-carte */
#mm-res { position: absolute; right: 0; bottom: calc(100% + 6px); width: 200px; padding: 8px 10px; background: var(--panel); border: 1px solid var(--gold); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.5); font-size: 13px; z-index: 9; }
#mm-res .ml-t { font-family: var(--title); color: var(--gold); margin-bottom: 4px; }
#mm-res .mr-l { display: flex; align-items: center; gap: 6px; padding: 2px 0; cursor: pointer; }
/* (07/11) avis au menu : mode economie d'energie de Windows, carte graphique integree */
.avis-pc { position: fixed; right: 24px; bottom: 24px; z-index: 40; width: min(460px, 86vw); padding: 12px 16px; border-radius: 10px; background: linear-gradient(180deg, rgba(48,34,16,0.95), rgba(28,20,10,0.95)); border: 2px solid var(--gold); color: #f0e6d0; font-family: var(--ui); font-size: 14px; line-height: 1.45; box-shadow: 0 10px 30px rgba(0,0,0,0.6); }
.avis-pc-t { font-family: var(--title); color: var(--gold); font-size: 17px; margin-bottom: 6px; }
.avis-pc-m { margin-bottom: 8px; }
.avis-pc-b { display: flex; gap: 8px; justify-content: flex-end; }
/* (07/11) menu principal : nouvelle ecriture (IM Fell English SC, petites capitales gravees) et une couleur tres douce par onglet :
   un liseré a gauche, un voile de la couleur sur le fond, le texte legerement teinte ; au survol la couleur s'avive */
.main-menu { --menu-font: "IM Fell English SC", var(--title); }
.main-menu .mbtn:not(.rainbow) {
  --c: #d8c8a8;
  font-family: var(--menu-font); font-size: 21px; letter-spacing: 0.6px; font-weight: 400; text-transform: none;
  color: color-mix(in srgb, var(--c) 62%, #fff6e2);
  border: 1px solid color-mix(in srgb, var(--c) 45%, rgba(232, 192, 96, 0.2)); border-left: 5px solid color-mix(in srgb, var(--c) 90%, transparent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 36%, rgba(40, 28, 14, 0.9)) 0%, color-mix(in srgb, var(--c) 12%, rgba(30, 22, 12, 0.88)) 55%, rgba(30, 22, 12, 0.88) 100%);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}
.main-menu .mbtn:not(.rainbow):hover {
  color: #fffaf0; border-left-color: var(--c);
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 42%, rgba(50, 36, 18, 0.92)) 0%, rgba(40, 30, 16, 0.9) 75%);
  box-shadow: 0 0 14px color-mix(in srgb, var(--c) 35%, transparent);
}
.main-menu .mbtn.primary { color: #fffaf0; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 48%, #6a4616) 0%, rgba(60, 40, 18, 0.95) 80%); border-color: var(--c); }
.main-menu .mbtn small { font-family: var(--ui); }
.main-menu .mbtn[data-a="continue"] { --c: #f0cf8e; }      /* ambre doux */
.main-menu .mbtn[data-a="new"] { --c: #a8d8a0; }           /* vert sauge */
.main-menu .mbtn[data-a="load"] { --c: #dcc9a2; }          /* sable */
.main-menu .mbtn[data-a="multi"] { --c: #9fc6ea; }         /* bleu ciel */
.main-menu .mbtn[data-a="options"] { --c: #c4b6e2; }       /* lavande */
.main-menu .mbtn[data-a="intro"] { --c: #efbfa2; }         /* peche */
.main-menu .mbtn[data-a="help"] { --c: #a6dcd8; }          /* eau claire */
.main-menu .mbtn[data-a="achievements"] { --c: #e8d890; }  /* paille */
.main-menu .mbtn[data-a="carnet"] { --c: #e6b4c2; }        /* rose ancien */
.main-menu .mbtn[data-a="profiles"] { --c: #bcd6a4; }      /* vert tendre */
.main-menu .mbtn[data-a="credits"] { --c: #cdb4da; }       /* mauve */
.main-menu .mbtn[data-a="quit"] { --c: #e6a8a2; }          /* rose brique */
/* (07/11, demande de l'utilisateur) atelier du protege : Homme en bleu clair, Femme en rose clair */
#vipcreator .vc-chip[data-k="sex"][data-i="0"] { background: rgba(140, 180, 235, 0.22); border-color: rgba(160, 196, 240, 0.7); color: #e4efff; }
#vipcreator .vc-chip[data-k="sex"][data-i="1"] { background: rgba(240, 160, 200, 0.22); border-color: rgba(244, 180, 214, 0.7); color: #ffe8f2; }
#vipcreator .vc-chip[data-k="sex"][data-i="0"].on { background: rgba(140, 180, 235, 0.55); border-color: #b4d0f4; color: #fff; }
#vipcreator .vc-chip[data-k="sex"][data-i="1"].on { background: rgba(240, 160, 200, 0.55); border-color: #f6c4dc; color: #fff; }
/* (11/11) ecran d'accueil : petit bouton « Quitter le jeu » en haut a droite */
#accueil-quitter { position: absolute; top: 16px; right: 18px; z-index: 5; font-size: 16px; padding: 7px 14px; opacity: 0.92; }
#accueil-quitter:hover { opacity: 1; }

/* (12/11, lisibilite) objectifs cliquables : « Comment faire ? » et bouton designe qui clignote */
#obj-list .obj.clic { cursor: pointer; }
#obj-list .obj.clic:hover { color: #ffe6a0; }
#obj-list .obj-q { display: inline-block; min-width: 14px; height: 14px; line-height: 14px; margin-left: 4px; border-radius: 50%; background: rgba(240, 200, 110, 0.85); color: #2a1e10; font-size: 10px; font-weight: bold; text-align: center; }
#obj-aide { display: none; margin-top: 6px; padding: 6px 8px; max-width: 280px; border-radius: 6px; background: rgba(30, 24, 16, 0.92); border: 1px solid rgba(240, 200, 110, 0.6); color: #f4ead2; font-size: 12px; line-height: 1.35; }
#obj-aide.on { display: block; }
.guide { animation: guidePulse 0.9s ease-in-out infinite; position: relative; z-index: 2; }
@keyframes guidePulse { 0%, 100% { box-shadow: 0 0 0 2px rgba(255, 210, 90, 0.95), 0 0 10px rgba(255, 200, 80, 0.7); } 50% { box-shadow: 0 0 0 4px rgba(255, 230, 140, 0.4), 0 0 18px rgba(255, 210, 90, 0.95); } }

/* (12/11, retour testeur) batiment qui ne sert plus a rien : bulle rouge qui clignote */
.wtip.vide { background: rgba(120, 20, 15, 0.92); border-color: #ff6a50; color: #ffe8e0; animation: wtipVide 1.1s ease-in-out infinite; }
@keyframes wtipVide { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 90, 60, 0); } 50% { box-shadow: 0 0 14px 3px rgba(255, 90, 60, 0.8); } }

/* (12/11, retour testeur) selection de plusieurs unites : une ligne par type, puis les portraits avec leur barre de vie */
.sel-types { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.sel-type { display: grid; grid-template-columns: 30px 1fr auto 70px; align-items: center; gap: 7px; padding: 2px 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); cursor: pointer; }
.sel-type:hover { border-color: var(--gold); background: rgba(70, 50, 20, 0.6); }
.sel-type .st-ic { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.sel-type .st-ic .gi { width: 28px; height: 28px; }
.sel-type .st-nom { font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sel-type .st-n { color: var(--gold); font-weight: 700; }
.sel-type .st-vie, .sp i { display: block; height: 5px; background: rgba(0, 0, 0, 0.6); border-radius: 3px; overflow: hidden; }
.sel-type .st-vie i { display: block; height: 100%; }
.sel-portraits { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
.sp { width: 30px; display: flex; flex-direction: column; align-items: center; gap: 2px; background: rgba(0, 0, 0, 0.35); border-radius: 4px; padding: 2px 1px 3px; font-size: 18px; }
.sp .gi { width: 26px; height: 26px; }
.sp i { width: 0; height: 3px; align-self: flex-start; margin-left: 2px; max-width: 26px; }

/* (15/11) ressource qui manque pour le bouton survole : elle clignote dans la barre du haut */
.res.manque { border-color: #ff5040; box-shadow: 0 0 10px rgba(255, 60, 40, 0.85); animation: shortBlink 0.45s ease-in-out infinite alternate; }
/* (20/11) exemplaires presque transparents des fenetres, dessines une fois au chargement (hud.prechauffer) : plus de gel a leur premiere apparition */
.prechauffe { opacity: 0.02 !important; pointer-events: none !important; }
