/* game.css — écran de partie : carte, HUD, panneaux, chat, navigation */

#screen-game { position: relative; }

#map-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

/* ── Info-bulle carte ── */
.map-tooltip {
  position: absolute;
  top: 0; left: 0;
  z-index: 60;
  pointer-events: none;
  background: rgba(16, 19, 34, 0.94);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  font-size: 0.82rem;
  max-width: 210px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  line-height: 1.45;
}

.tt-district { color: var(--teal); font-weight: 700; font-size: 0.76rem; margin-bottom: 0.2rem; }

/* ── HUD haut ── */
.hud-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1rem;
  pointer-events: none;
}

.hud-money {
  background: rgba(16, 19, 34, 0.88);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.45rem 0.9rem;
  display: flex;
  flex-direction: column;
  min-width: 150px;
}

.hud-label { font-size: 0.7rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; }
.hud-value { font-size: 1.25rem; font-weight: 800; }
.hud-value.gold { color: var(--gold); }

.hud-center { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; }

.hud-timer {
  background: rgba(16, 19, 34, 0.88);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.35rem 1.4rem;
  font-size: 1.7rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.hud-timer.urgent { color: var(--danger); border-color: var(--danger); animation: pulse-danger 1s ease-in-out infinite; }

@keyframes pulse-danger {
  0%, 100% { box-shadow: 0 0 0 rgba(224, 85, 85, 0); }
  50% { box-shadow: 0 0 18px rgba(224, 85, 85, 0.55); }
}

.events-bar { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: center; }

.event-chip {
  background: rgba(232, 194, 87, 0.14);
  border: 1px solid var(--gold);
  border-radius: 99px;
  padding: 0.2rem 0.7rem;
  font-size: 0.76rem;
  color: var(--gold);
}

/* ── Classement flottant ── */
.leaderboard-box {
  position: absolute;
  top: 86px; left: 12px;
  z-index: 40;
  background: rgba(16, 19, 34, 0.88);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
  width: 205px;
  max-height: 40vh;
  overflow-y: auto;
}

.lb-title { font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.4rem; }

#leaderboard { list-style: none; display: flex; flex-direction: column; gap: 0.28rem; }

.lb-row { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; }
.lb-row.lb-you { background: rgba(78, 205, 196, 0.12); border-radius: 6px; }
.lb-rank { width: 14px; text-align: center; color: var(--text-dim); font-size: 0.72rem; }
.lb-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-worth { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 0.76rem; }

/* ── Conseil contextuel ── */
.hint {
  position: absolute;
  top: 86px; left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  background: rgba(78, 205, 196, 0.14);
  border: 1px solid var(--teal);
  border-radius: 99px;
  padding: 0.45rem 0.6rem 0.45rem 1rem;
  font-size: 0.86rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  max-width: min(520px, calc(100vw - 260px));
}

.hint button { background: none; border: none; color: var(--text-dim); font-size: 0.9rem; }

/* ── Fil d'actualités ── */
.news-feed {
  position: absolute;
  left: 12px; bottom: 74px;
  z-index: 35;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.3rem;
  width: 300px;
  pointer-events: none;
}

.news-item {
  background: rgba(16, 19, 34, 0.82);
  border-left: 3px solid var(--teal);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  font-size: 0.76rem;
  color: var(--text-dim);
  transition: opacity 0.9s ease;
}

.news-item.fading { opacity: 0; }

/* ── Zoom ── */
.zoom-controls {
  position: absolute;
  right: 12px; bottom: 74px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.zoom-controls .btn { font-size: 1.1rem; width: 40px; height: 40px; }

/* ── Panneau latéral ── */
.side-panel {
  position: absolute;
  top: 78px; right: 12px; bottom: 70px;
  z-index: 55;
  width: 330px;
  background: rgba(20, 24, 43, 0.96);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.55);
  animation: panel-in 0.22s ease;
}

@keyframes panel-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.8rem 1rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 { font-size: 1.1rem; color: var(--teal); }

.panel-content { padding: 0.9rem 1rem; overflow-y: auto; display: flex; flex-direction: column; gap: 0.6rem; }

.panel-empty { color: var(--text-dim); font-size: 0.9rem; line-height: 1.5; text-align: center; padding: 1.4rem 0.4rem; }
.panel-sub { font-size: 0.8rem; color: var(--text-dim); }
.panel-note { font-size: 0.78rem; color: var(--text-dim); }
.panel-h3 { font-size: 0.88rem; margin-top: 0.5rem; }

.price-tag { font-size: 1.3rem; font-weight: 800; color: var(--gold); }

.shop-head { font-size: 1.05rem; }
.shop-perf {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text-dim);
}

.stock-bar {
  height: 9px;
  background: var(--bg);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.stock-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--success)); transition: width 0.4s ease; }

.range-legend { display: flex; justify-content: space-between; font-size: 0.68rem; color: var(--text-dim); }

.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }

.type-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.4rem;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  transition: border-color 0.15s ease, transform 0.1s ease;
}

.type-card:hover { border-color: var(--teal); transform: translateY(-2px); }
.type-emoji { font-size: 1.5rem; }
.type-name { font-size: 0.8rem; font-weight: 700; }
.type-info { font-size: 0.66rem; color: var(--text-dim); }

.offer-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 0.4rem; }
.offer-form input { padding: 0.45rem 0.5rem; font-size: 0.88rem; }

.offers-list { display: flex; flex-direction: column; gap: 0.5rem; }

.offer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  font-size: 0.82rem;
}

.market-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.market-table th, .market-table td { padding: 0.4rem 0.35rem; text-align: left; border-bottom: 1px solid var(--border); }
.market-table th { color: var(--text-dim); font-size: 0.7rem; text-transform: uppercase; }
.market-table .lb-you { background: rgba(78, 205, 196, 0.08); }

.trend.up { color: var(--danger); }
.trend.down { color: var(--success); }
.trend.flat { color: var(--text-dim); }

/* ── Navigation bas ── */
.bottom-nav {
  position: absolute;
  bottom: 12px; left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  gap: 0.4rem;
  background: rgba(16, 19, 34, 0.92);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.4rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.nav-btn {
  background: transparent;
  border: none;
  border-radius: 11px;
  color: var(--text);
  font-size: 1.15rem;
  padding: 0.45rem 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  transition: background 0.15s ease;
}

.nav-btn span { font-size: 0.62rem; color: var(--text-dim); }
.nav-btn:hover { background: var(--bg-card); }
.nav-btn.active { background: rgba(78, 205, 196, 0.18); }
.nav-btn.active span { color: var(--teal); }
.nav-danger:hover { background: rgba(224, 85, 85, 0.18); }

/* ── Chat ── */
.chat-box {
  position: fixed;
  left: 12px; bottom: 12px;
  z-index: 70;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-start;
}

.chat-toggle {
  position: relative;
  background: rgba(16, 19, 34, 0.92);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 46px; height: 46px;
  font-size: 1.2rem;
}

.chat-unread {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 800;
  border-radius: 99px;
  padding: 0.1rem 0.35rem;
}

.chat-body {
  width: 280px;
  background: rgba(16, 19, 34, 0.95);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 0.5rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-box.collapsed .chat-body { display: none; }

.chat-messages {
  height: 190px;
  overflow-y: auto;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
}

.chat-msg { word-wrap: break-word; }

.chat-input-row { display: flex; border-top: 1px solid var(--border); }
.chat-input-row input { flex: 1; border: none; border-radius: 0; background: transparent; font-size: 0.85rem; }
.chat-input-row .btn { border: none; border-radius: 0; background: transparent; color: var(--teal); }

/* ── Responsive ── */
@media (max-width: 760px) {
  .leaderboard-box { display: none; }
  .hud-money { min-width: 0; padding: 0.35rem 0.6rem; }
  .hud-value { font-size: 1rem; }
  .hud-timer { font-size: 1.25rem; padding: 0.25rem 0.9rem; }
  .hint { top: 72px; max-width: calc(100vw - 24px); font-size: 0.78rem; }
  .side-panel { left: 8px; right: 8px; width: auto; top: auto; bottom: 66px; max-height: 58vh; }
  .news-feed { display: none; }
  .zoom-controls { bottom: 130px; }
  .nav-btn { padding: 0.4rem 0.55rem; }
  .nav-btn span { display: none; }
  .chat-box { bottom: 66px; }
}
