/* ═══════════════════════════════════════════════════════════
   bottom-panel.css — v0.9.3 — Slider hexagonal bas d'écran
   ═══════════════════════════════════════════════════════════ */

:root {
  --hex-size: 82px;
  --bp-slider-h: 100px;
}

/* ══════════════════════════════════════════════════════════
   SLIDER — barre hexagonale fixe au-dessus de hud-bottom
══════════════════════════════════════════════════════════ */
#bp-drawer {
  position: fixed;
  left: 0; right: 60px; /* laisser place aux boutons zoom */
  bottom: var(--hud-bottom-h, 52px);
  z-index: 190;
  height: var(--bp-slider-h);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(8,5,18,0) 0%, rgba(8,5,18,0.94) 28%);
  transition: transform 0.26s cubic-bezier(0.4,0,0.2,1), opacity 0.18s;
}
.bp-drawer-closed { transform: translateY(calc(100% + 4px)); opacity: 0; pointer-events: none; }
.bp-drawer-open   { transform: translateY(0); opacity: 1; pointer-events: all; }

/* Titre case + bouton fermer */
.bp-drawer-header {
  display: flex; align-items: center; justify-content: center;
  padding: 2px 42px 0;
  flex-shrink: 0;
  position: relative;
}
.bp-drag-handle { display: none; }
.bp-drawer-title {
  font-family: Cinzel, serif; font-size: 11px;
  color: rgba(200,149,26,0.5); letter-spacing: 0.07em;
  text-transform: uppercase; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 220px;
}
.bp-drawer-close {
  position: absolute; right: 6px; top: -2px;
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(10,6,22,0.9); border: 1px solid rgba(200,149,26,0.25);
  color: rgba(255,255,255,0.35); font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.13s; line-height: 1;
}
.bp-drawer-close:hover { color: #e05050; border-color: rgba(224,80,80,0.5); }

/* ── Corps scrollable ─ */
.bp-drawer-body {
  flex: 1;
  display: flex; align-items: center;
  overflow-x: auto; overflow-y: hidden;
  padding: 6px 10px 8px;
  gap: 7px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.bp-drawer-body::-webkit-scrollbar { display: none; }

/* ══════════════════════════════════════════════════════════
   HEXAGONE
══════════════════════════════════════════════════════════ */
.hex-btn {
  position: relative;
  flex-shrink: 0;
  width: var(--hex-size);
  height: calc(var(--hex-size) * 1.14);
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform 0.14s, filter 0.14s;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  user-select: none;
}
.hex-btn:hover:not(.hex-locked) { transform: translateY(-4px); }
.hex-btn:active:not(.hex-locked) { transform: translateY(-1px); }

/* SVG hexa en fond */
.hex-bg { position: absolute; inset: 0; z-index: 0; }
.hex-bg svg { width: 100%; height: 100%; display: block; }

/* Remplissage + contour SVG */
.hex-poly-fill   { transition: fill 0.14s; }
.hex-poly-stroke { transition: stroke 0.14s, stroke-width 0.14s; fill: none; }

/* États par défaut */
.hex-btn          .hex-poly-fill   { fill: rgba(10,8,24,0.9); }
.hex-btn          .hex-poly-stroke { stroke: rgba(200,149,26,0.28); stroke-width: 1.5; }
.hex-btn.hex-ok   .hex-poly-stroke { stroke: rgba(200,149,26,0.55); }
.hex-btn:hover:not(.hex-locked) .hex-poly-fill   { fill: rgba(200,149,26,0.14); }
.hex-btn:hover:not(.hex-locked) .hex-poly-stroke { stroke: rgba(240,200,80,0.85); stroke-width: 2; }

.hex-btn.hex-locked .hex-poly-fill   { fill: rgba(6,4,16,0.7); }
.hex-btn.hex-locked .hex-poly-stroke { stroke: rgba(255,255,255,0.08); }
.hex-btn.hex-era-locked .hex-poly-fill   { fill: rgba(20,10,40,0.8); }
.hex-btn.hex-era-locked .hex-poly-stroke { stroke: rgba(160,80,255,0.22); }
.hex-btn.hex-action .hex-poly-stroke { stroke: rgba(128,192,255,0.48); }
.hex-btn.hex-action:hover:not(.hex-locked) .hex-poly-fill   { fill: rgba(60,100,220,0.16); }
.hex-btn.hex-action:hover:not(.hex-locked) .hex-poly-stroke { stroke: rgba(128,192,255,0.9); stroke-width: 2; }
.hex-btn.hex-danger .hex-poly-stroke { stroke: rgba(200,80,80,0.42); }
.hex-btn.hex-danger:hover:not(.hex-locked) .hex-poly-fill   { fill: rgba(180,40,40,0.18); }
.hex-btn.hex-danger:hover:not(.hex-locked) .hex-poly-stroke { stroke: rgba(224,80,80,0.9); stroke-width: 2; }

/* Icône */
.hex-icon {
  position: relative; z-index: 1;
  font-size: 28px; line-height: 1;
  transition: filter 0.13s;
}
.hex-locked .hex-icon { opacity: 0.3; filter: grayscale(0.9); }

/* Label */
.hex-label {
  position: relative; z-index: 1;
  font-size: 9.5px; font-family: Cinzel, serif;
  color: rgba(200,180,140,0.82); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: calc(var(--hex-size) + 4px); line-height: 1.2;
}
.hex-locked .hex-label { opacity: 0.38; }

/* Bouton info ⓘ (mobile) */
.hex-info-btn {
  position: absolute; top: 2px; left: 3px; z-index: 5;
  width: 15px; height: 15px; border-radius: 50%;
  background: rgba(80,130,240,0.22); border: 1px solid rgba(100,160,255,0.4);
  color: #80b8ff; font-size: 8px; font-weight: 700; font-style: italic;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.12s;
  font-family: serif;
}
.hex-info-btn:hover { background: rgba(80,130,240,0.45); }

/* Badge ère */
.hex-era {
  position: absolute; top: 3px; right: 3px; z-index: 3;
  font-size: 7.5px; padding: 0 3px; border-radius: 4px; font-family: Cinzel, serif;
}
.hex-era.era-2 { background: rgba(100,180,255,.15); color: #80c8ff; border: 1px solid rgba(100,180,255,.3); }
.hex-era.era-3 { background: rgba(200,100,255,.15); color: #d090ff; border: 1px solid rgba(200,100,255,.3); }

/* Coût mini */
.hex-cost {
  position: absolute; bottom: 3px; left: 50%;
  transform: translateX(-50%);
  z-index: 2; font-size: 8.5px; color: #80e080;
  white-space: nowrap; pointer-events: none;
}
.hex-cost.short { color: #e08080; }

/* Séparateur */
.hex-separator {
  width: 1px; height: 54px;
  background: rgba(200,149,26,0.13);
  flex-shrink: 0; align-self: center;
}

/* ══════════════════════════════════════════════════════════
   TOOLTIP BÂTIMENT
══════════════════════════════════════════════════════════ */
#bld-tooltip {
  position: fixed; z-index: 9998; pointer-events: none;
  background: linear-gradient(145deg, #1c1530, #0e0b1e);
  border: 1px solid rgba(200,149,26,.55);
  border-radius: 12px; padding: 14px 16px; width: 255px;
  box-shadow: 0 10px 36px rgba(0,0,0,.88);
  opacity: 0; transform: translateY(6px) scale(.97);
  transition: opacity .14s ease, transform .14s ease;
}
#bld-tooltip.visible { opacity: 1; transform: translateY(0) scale(1); }
#bld-tooltip.pinned  { pointer-events: auto; }
.btt-close { display: none; position: absolute; top: 8px; right: 10px; background: none; border: none; color: rgba(255,255,255,.4); font-size: 15px; cursor: pointer; padding: 2px 4px; }
.btt-head  { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid rgba(200,149,26,.18); }
.btt-icon  { font-size: 28px; line-height: 1; flex-shrink: 0; }
.btt-title { display: flex; flex-direction: column; gap: 2px; }
.btt-name  { font-family: Cinzel, serif; font-size: 15px; color: #f0d880; font-weight: 700; line-height: 1.25; }
.btt-era   { display: inline-block; font-size: 11px; padding: 1px 5px; border-radius: 6px; font-family: Cinzel, serif; align-self: flex-start; }
.btt-era.era-2 { background: rgba(100,180,255,.15); color: #80c8ff; border: 1px solid rgba(100,180,255,.3); }
.btt-era.era-3 { background: rgba(200,100,255,.15); color: #d090ff; border: 1px solid rgba(200,100,255,.3); }
.btt-desc { font-size: 13px; color: rgba(220,200,160,.65); line-height: 1.5; margin-bottom: 7px; }
.btt-section { font-family: Cinzel, serif; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: rgba(200,149,26,.55); margin: 5px 0 3px; }
.btt-prods { display: flex; flex-direction: column; gap: 2px; margin-bottom: 5px; }
.btt-prod    { font-size: 13px; color: #80e080; }
.btt-consume { font-size: 13px; color: #e09050; }
.btt-workers { font-size: 13px; color: rgba(200,200,200,.45); margin-bottom: 2px; }
.btt-lvl     { font-size: 12px; color: rgba(200,149,26,.5); margin-bottom: 4px; }
.btt-state { font-size: 13px; padding: 4px 8px; border-radius: 6px; margin-top: 4px; }
.btt-state.ok { background: rgba(80,200,80,.1); color: #80e080; border: 1px solid rgba(80,200,80,.22); }
.btt-state.ko { background: rgba(200,80,80,.08); color: #e08080; border: 1px solid rgba(200,80,80,.18); font-size: 12px; }
.btt-costs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.btt-cost-item { font-size: 12px; font-weight: 700; padding: 1px 6px; border-radius: 8px; }
.btt-cost-ok { color: #80e080; background: rgba(80,200,80,.1); border: 1px solid rgba(80,200,80,.2); }
.btt-cost-ko { color: #e08080; background: rgba(200,80,80,.1); border: 1px solid rgba(200,80,80,.2); }

/* ══════════════════════════════════════════════════════════
   LEGACY - bp-card classes (gardées pour bâtiments existants)
══════════════════════════════════════════════════════════ */
.bp-cards-row, .bp-terrain-cards { display: flex; gap: 8px; flex-wrap: wrap; }
.bp-card { background: rgba(255,255,255,.04); border: 1px solid rgba(200,149,26,.25); border-radius: 8px; padding: 10px; min-width: 110px; max-width: 180px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.bp-card:hover { border-color: rgba(200,149,26,.55); }
.bp-card.bp-locked { opacity: .55; }
.bp-card-glyph  { font-size: 26px; text-align: center; }
.bp-card-name   { font-family: Cinzel, serif; font-size: 13px; color: #e8d090; text-align: center; }
.bp-card-desc   { font-size: 12px; color: rgba(255,255,255,.4); text-align: center; line-height: 1.4; }
.bp-card-cost   { font-size: 12px; text-align: center; }
.bp-card-extra  { font-size: 12px; color: #80c0ff; text-align: center; }
.bp-card-action { margin-top: 3px; background: rgba(200,149,26,.15); border: 1px solid rgba(200,149,26,.4); border-radius: 5px; color: #e8d090; font-family: Cinzel, serif; font-size: 12px; padding: 5px; cursor: pointer; width: 100%; }
.bp-card-action:hover { background: rgba(200,149,26,.3); }
.bp-bld-header  { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.bp-bld-glyph   { font-size: 30px; flex-shrink: 0; }
.bp-bld-name    { font-family: Cinzel, serif; font-size: 15px; color: #e8d090; }
.bp-bld-lvl     { font-size: 12px; color: rgba(255,255,255,.4); margin-top: 1px; }
.bp-prod-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 5px; }
.bp-prod-badge  { background: rgba(128,224,128,.1); border: 1px solid rgba(128,224,128,.3); border-radius: 4px; padding: 2px 6px; font-size: 12px; color: #80e080; }
.bp-adj-line    { font-size: 12px; color: #80c0ff; margin-bottom: 5px; }
.bp-lvlbar-track{ height: 4px; background: rgba(255,255,255,.08); border-radius: 2px; margin-bottom: 6px; overflow: hidden; }
.bp-lvlbar-fill { height: 100%; background: linear-gradient(90deg,#c8951a,#f0c040); border-radius: 2px; transition: width .4s; }
.bp-bld-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.bp-upgrade-btn { flex: 1; background: rgba(128,192,255,.12); border: 1px solid rgba(128,192,255,.35); border-radius: 6px; color: #80c0ff; font-family: Cinzel, serif; font-size: 12px; padding: 6px 8px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.bp-upgrade-btn:hover { background: rgba(128,192,255,.25); }
.bp-upgrade-cost { font-size: 11px; color: rgba(255,255,255,.5); }
.bp-demolish-btn { background: rgba(200,80,80,.1); border: 1px solid rgba(200,80,80,.3); border-radius: 6px; color: #e08080; font-size: 12px; padding: 6px 10px; cursor: pointer; }
.bp-demolish-btn:hover { background: rgba(200,80,80,.25); }
.bp-max-lvl-tag { font-family: Cinzel, serif; font-size: 12px; color: #f0c040; padding: 5px; text-align: center; border: 1px solid rgba(240,192,64,.3); border-radius: 6px; flex: 1; }
.bp-empty-msg   { color: rgba(255,255,255,.4); font-style: italic; padding: 4px 0; font-size: 13px; }
.bp-base-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.bp-base-row    { display: flex; justify-content: space-between; font-size: 12px; color: rgba(255,255,255,.7); padding: 4px 8px; background: rgba(255,255,255,.04); border-radius: 4px; }
.bp-locked      { cursor: not-allowed; opacity: .5; }
.bp-hint        { font-size: 12px; color: rgba(200,149,26,.7); font-style: italic; }
.bp-section-label { font-family: Cinzel, serif; font-size: 12px; color: rgba(200,149,26,.6); text-transform: uppercase; letter-spacing: .08em; }
.bp-era-badge   { display: inline-block; font-size: 11px; padding: 1px 5px; border-radius: 8px; margin-left: 3px; vertical-align: middle; font-family: Cinzel, serif; }
.era-2 { background: rgba(100,180,255,.12); color: #80c8ff; border: 1px solid rgba(100,180,255,.25); }
.era-3 { background: rgba(200,100,255,.12); color: #d090ff; border: 1px solid rgba(200,100,255,.25); }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  :root { --hex-size: 68px; --bp-slider-h: 100px; }
  #bp-drawer { right: 0; }
  .hex-icon { font-size: 26px; }
  .hex-label { font-size: 8px; }
  .btt-close { display: block; }
  #bld-tooltip.pinned {
    width: calc(100vw - 20px);
    left: 10px !important;
    bottom: calc(var(--bp-slider-h) + var(--hud-bottom-h, 52px) + 6px);
    top: auto !important;
  }
}
@media (min-width: 601px) {
  .hex-info-btn { display: none; }
}
@media (min-width: 1200px) {
  :root { --hex-size: 74px; --bp-slider-h: 108px; }
  .hex-icon { font-size: 28px; }
}

/* ══════════════════════════════════════════════════════════
   BUILD BAR — Barre de construction (cards larges)
══════════════════════════════════════════════════════════ */

#bb-bar {
  position: fixed;
  left: 0; right: 0;
  bottom: var(--hud-bottom-h, 52px);
  z-index: 210;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  visibility: hidden;
}
#bb-bar.bb-bar-visible { visibility: visible; }

/* ── Tiroir cards ─────────────────────────────────────── */
#bb-drawer {
  pointer-events: none;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 52px 14px 14px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(200,149,26,0.3) transparent;
  background: linear-gradient(180deg,
    rgba(6,3,14,0)   0%,
    rgba(8,4,22,0.96) 14%,
    rgba(8,4,22,0.99) 100%);
  min-height: 0;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.26s cubic-bezier(0.4,0,0.2,1), opacity 0.2s, padding 0.18s;
}
#bb-drawer::-webkit-scrollbar { height: 3px; }
#bb-drawer::-webkit-scrollbar-thumb { background: rgba(200,149,26,0.3); border-radius: 2px; }
#bb-drawer.bb-drawer-open  { pointer-events: all; max-height: 172px; opacity: 1; }
#bb-drawer.bb-drawer-closed { pointer-events: none; max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; }

/* ── Card bâtiment (large) ───────────────────────────── */
.bb-card {
  position: relative;
  flex-shrink: 0;
  width: 120px;
  min-height: 136px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  padding: 10px 7px 8px;
  border-radius: 12px;
  background: rgba(12,8,28,0.93);
  border: 1.5px solid rgba(200,149,26,0.25);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
  scroll-snap-align: start;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.bb-card:hover:not(.bb-card-locked) {
  transform: translateY(-6px);
  border-color: rgba(240,200,80,0.8);
  background: rgba(20,13,42,0.97);
  box-shadow: 0 8px 24px rgba(0,0,0,0.55), 0 0 14px rgba(200,149,26,0.2);
}
.bb-card:active:not(.bb-card-locked) { transform: translateY(-3px); }
.bb-card.bb-card-locked {
  opacity: 0.42;
  cursor: default;
  border-color: rgba(255,255,255,0.07);
  background: rgba(8,5,16,0.85);
}
.bb-card.bb-card-danger { border-color: rgba(220,70,70,0.4); }
.bb-card.bb-card-danger:hover:not(.bb-card-locked) {
  border-color: rgba(230,80,80,0.85);
  background: rgba(32,10,10,0.97);
  box-shadow: 0 8px 24px rgba(0,0,0,0.55), 0 0 14px rgba(220,70,70,0.22);
}

/* Icône principale */
.bb-card-icon {
  font-size: 32px;
  line-height: 1;
  margin-bottom: 2px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
/* Nom */
.bb-card-name {
  font-family: Cinzel, serif;
  font-size: 11.5px;
  font-weight: 700;
  color: rgba(240,215,150,0.95);
  text-align: center;
  line-height: 1.25;
  letter-spacing: 0.02em;
  word-break: break-word;
  hyphens: auto;
}
/* Description courte */
.bb-card-desc {
  font-size: 10px;
  color: rgba(180,160,100,0.65);
  text-align: center;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
/* Coûts */
.bb-card-costs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px 6px;
  margin-top: auto;
  padding-top: 4px;
  border-top: 1px solid rgba(255,255,255,0.07);
  width: 100%;
}
.bb-cost-chip {
  font-size: 11px;
  color: rgba(210,230,160,0.9);
  white-space: nowrap;
}
.bb-cost-chip.short { color: #e08060; }

/* Verrou */
.bb-card-lock {
  position: absolute;
  top: 6px; right: 7px;
  font-size: 13px;
  opacity: 0.65;
}

/* Message vide */
.bb-card-empty {
  color: rgba(180,160,100,0.5);
  font-size: 13px;
  font-style: italic;
  padding: 20px 16px;
  white-space: nowrap;
  align-self: center;
}

/* ── Dock (barre des catégories) ─────────────────────── */
#bb-dock {
  pointer-events: all;
  display: flex;
  justify-content: stretch;
  align-items: stretch;
  padding: 0 0 calc(env(safe-area-inset-bottom, 0px));
  background: rgba(8,5,18,0.99);
  border-top: 1px solid rgba(200,149,26,0.3);
  backdrop-filter: blur(14px);
  box-shadow: 0 -2px 18px rgba(0,0,0,0.65);
}

.bb-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
  padding: 8px 4px 9px;
  border: none;
  border-top: 2.5px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: background 0.13s, border-color 0.13s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.bb-tab:hover  { background: rgba(255,255,255,0.06); }
.bb-tab-active {
  background: rgba(200,149,26,0.13);
  border-top-color: rgba(220,175,50,0.8);
}
.bb-tab-icon  { font-size: 24px; line-height: 1; }
.bb-tab-label {
  font-family: Cinzel, serif;
  font-size: 9.5px;
  color: rgba(200,165,80,0.7);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1;
  white-space: nowrap;
}
.bb-tab-active .bb-tab-icon  { filter: drop-shadow(0 0 6px rgba(240,200,80,0.6)); }
.bb-tab-active .bb-tab-label { color: rgba(245,210,80,1); }

/* Tooltip CSS au survol du tab */
.bb-tab[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10,6,22,0.97);
  border: 1px solid rgba(200,149,26,0.45);
  color: rgba(240,215,150,0.95);
  font-size: 11px;
  font-family: sans-serif;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 6px;
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 3px 10px rgba(0,0,0,0.65);
}

@media (max-width: 600px) {
  .bb-card        { width: 104px; min-height: 128px; padding: 9px 6px 7px; gap: 3px; }
  .bb-card-icon   { font-size: 29px; }
  .bb-card-name   { font-size: 11px; }
  .bb-card-desc   { font-size: 9.5px; }
  .bb-cost-chip   { font-size: 10px; }
  #bb-drawer      { gap: 8px; padding: 12px 46px 12px 10px; }
  #bb-drawer.bb-drawer-open { max-height: 158px; }
  .bb-tab-label   { font-size: 8.5px; }
  .bb-tab         { padding: 7px 3px 8px; }
  .bb-tab-icon    { font-size: 22px; }
}

