/* =====================================================================
   Braises — exploration isométrique : feux, lézards et chaleur.
   ===================================================================== */
:root {
  --bg: #05070e;
  --panel: #141a2b;
  --panel2: #0d1220;
  --line: #2a3350;
  --text: #eef2fa;
  --muted: #93a0bd;
  --accent: #ff9a4d;
  --accent2: #ff5d5d;
  --cold: #7fb3ff;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  user-select: none;
}

#game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

/* ============================ HUD ============================ */
#hud { position: fixed; inset: 0; pointer-events: none; display: none; }
body.playing #hud { display: block; }

#topbar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 12px 14px; gap: 10px;
}
#stats {
  display: flex; gap: 16px;
  background: rgba(10, 14, 26, .72);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 14px; font-size: .95rem; font-weight: 600;
  backdrop-filter: blur(6px);
}
.stat { line-height: 1.1; }
.stat .label {
  display: block; font-size: .6rem; font-weight: 500; color: var(--muted);
  letter-spacing: .07em; text-transform: uppercase; margin-top: 3px;
}
#minimapWrap {
  background: rgba(10, 14, 26, .72);
  border: 1px solid var(--line); border-radius: 12px; padding: 8px;
  backdrop-filter: blur(6px); text-align: center;
}
#minimap { width: 168px; height: 168px; display: block; border-radius: 8px; background: #060a14; }
#minimapLabel {
  display: block; font-size: .6rem; color: var(--muted);
  letter-spacing: .08em; text-transform: uppercase; margin-top: 6px;
}

#toasts {
  position: absolute; top: 76px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  max-width: min(700px, 92vw);
}
.toast {
  background: rgba(18, 22, 38, .93);
  border: 1px solid #3a4470; border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 9px 14px; font-size: .92rem; line-height: 1.35;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .45);
  animation: tin .25s ease;
}
.toast.out { animation: tout .5s ease forwards; }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes tout { to { opacity: 0; transform: translateY(-6px); } }

#bottom {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px;
}
#activePanel {
  pointer-events: auto;
  background: rgba(10, 14, 26, .8);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 14px; min-width: 265px;
  backdrop-filter: blur(6px);
}
#activeName { font-weight: 700; font-size: .95rem; margin-bottom: 7px; }
#heatBar { height: 13px; border-radius: 8px; background: #0a0f1c; border: 1px solid #1d2540; overflow: hidden; }
#heatFill { height: 100%; width: 0%; border-radius: 8px; background: #ffb163; transition: width .12s linear; }
#activeMeta { display: flex; justify-content: space-between; margin-top: 6px; font-size: .8rem; color: var(--muted); }
#activeStatus { font-weight: 700; }
#activeStatus.ok    { color: #ffd08a; }
#activeStatus.hot   { color: #ff9b5a; }
#activeStatus.cold  { color: #8fb8ff; }
#activeStatus.frozen{ color: #9fd0ff; }

#squad { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.chip {
  pointer-events: auto; display: flex; gap: 8px; align-items: center;
  background: rgba(10, 14, 26, .8);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 7px 10px; cursor: pointer; min-width: 118px;
  transition: border-color .15s, transform .15s;
}
.chip:hover { border-color: #4c5a8f; }
.chip.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(255, 154, 77, .35), 0 6px 18px rgba(255, 120, 50, .15);
  transform: translateY(-2px);
}
.chip.frozen { opacity: .78; border-color: #3d5f8f; }
.chip .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 2px rgba(0,0,0,.28); }
.chip .cname { font-size: .78rem; font-weight: 600; line-height: 1.15; margin-bottom: 4px; white-space: nowrap; }
.chip .cbar { width: 78px; height: 5px; border-radius: 4px; background: #0a0f1c; overflow: hidden; }
.chip .cbar i { display: block; height: 100%; width: 100%; background: #ffb163; transition: width .12s linear; }

#actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
#actions button {
  pointer-events: auto;
  background: rgba(16, 21, 38, .88); color: var(--text);
  border: 1px solid var(--line); border-radius: 11px;
  padding: 9px 12px; font-size: .86rem; font-weight: 600;
  cursor: pointer; display: flex; gap: 8px; align-items: center;
  font-family: inherit; touch-action: manipulation;
}
#actions button:hover { border-color: #4c5a8f; }
#actions button .k {
  font-size: .6rem; color: var(--muted);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px;
}
#actions button.on { border-color: var(--accent); color: #ffd6a8; }
#btnBreak.held { background: #3a2415; border-color: var(--accent); }

/* ============================ Overlays ============================ */
.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 6, 12, .74); backdrop-filter: blur(5px);
  padding: 20px;
}
.overlay.hidden { display: none; }
.panel {
  max-width: 660px; width: 100%; max-height: 92dvh; overflow: auto;
  background: linear-gradient(180deg, #171d31, #0d1220);
  border: 1px solid var(--line); border-radius: 20px;
  padding: clamp(20px, 4vw, 36px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.panel h1 {
  margin: 0 0 8px; font-size: clamp(1.7rem, 5vw, 2.4rem); letter-spacing: .06em;
  background: linear-gradient(90deg, #ffb163, #ff5d5d);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.panel p { color: #c6cede; line-height: 1.55; font-size: .95rem; margin: 10px 0; }
.panel p.sub { color: #e9dfd4; font-size: 1.02rem; }
.panel b { color: #ffd6a8; }
.controls { display: grid; gap: 8px; margin: 16px 0; font-size: .9rem; color: #c6cede; }
kbd {
  background: #0a0f1c; border: 1px solid #2a3350; border-bottom-width: 2px;
  border-radius: 6px; padding: 1px 6px; font-family: ui-monospace, monospace; font-size: .8rem;
}
.warn {
  background: rgba(80, 130, 220, .12); border: 1px solid #2c4470;
  border-radius: 10px; padding: 10px 12px; font-size: .88rem;
}
button.big {
  margin-top: 14px; width: 100%; padding: 14px;
  font-size: 1.05rem; font-weight: 800; border-radius: 14px;
  border: 1px solid #7a4a22;
  background: linear-gradient(180deg, #ffb163, #ff7a3c);
  color: #241305; cursor: pointer; font-family: inherit; letter-spacing: .02em;
}
button.big:hover { filter: brightness(1.07); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 16px 0; }
.stats div {
  background: #0c1120; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font-size: .8rem; color: var(--muted);
}
.stats div b { display: block; color: var(--text); font-size: 1.02rem; margin-top: 3px; }

@media (max-width: 860px) {
  #minimap { width: 118px; height: 118px; }
  #stats { font-size: .76rem; gap: 10px; padding: 6px 10px; }
  .stat .label { font-size: .52rem; }
  #bottom { gap: 8px; padding: 8px; }
  #activePanel { min-width: 0; flex: 1 1 100%; }
  #actions { margin-left: 0; width: 100%; justify-content: space-between; }
  #actions button { padding: 8px 10px; font-size: .78rem; }
  .chip { min-width: 100px; }
  #toasts { top: 64px; }
}
