/* ============================================================
   DataCenter Manager — Feuille de style principale
   ============================================================ */

/* ── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: linear-gradient(180deg, #4dafff 0%, #87cefa 45%, #cfefff 100%);
  color: #1f2d3d;
  font-family: 'Inter', sans-serif;
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── TOP BAR ──────────────────────────────────────────────── */
#topbar {
  height: 62px; flex-shrink: 0; padding: 0 28px;
  display: flex; align-items: center; gap: 0; flex-wrap: nowrap;
  background: rgba(255,255,255,0.97);
  border-bottom: 1px solid rgba(210,228,248,0.8); z-index: 200;
}
.topbar-brand {
  font-family: 'Oxanium', sans-serif; font-size: 17px; font-weight: 800;
  color: #2f80ed; flex-shrink: 0; margin-right: 24px; letter-spacing: 1px;
}
.stat {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; padding: 0 16px;
  border-right: 1px solid #ecf0f1;
}
.stat-label  { color: #bdc3c7; font-size: 11px; }
.stat-value  { color: #2c3e50; font-weight: 700; font-family: 'Oxanium', sans-serif; font-size: 14px; }
.stat-value.good { color: #2ecc71; }
.stat-value.warn { color: #f39c12; }
.stat-value.bad  { color: #e74c3c; }

#topbar-user {
  margin-left: auto; display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.user-badge {
  font-size: 12px; color: #7f8c8d; font-family: 'Oxanium', sans-serif; font-weight: 700;
}

/* ── SPEED CONTROLS ───────────────────────────────────────── */
#speed-controls { display: flex; gap: 6px; flex-shrink: 0; margin-left: 12px; }
.speed-btn {
  background: #f0f3f7; border: 1.5px solid #d5dbe4; color: #7f8c8d;
  padding: 5px 14px; border-radius: 9px; cursor: pointer;
  font-size: 12px; font-family: 'Oxanium', sans-serif; font-weight: 700;
  transition: all 0.15s;
}
.speed-btn.active {
  background: linear-gradient(135deg, #1e6fc2, #2f80ed);
  color: #fff; border-color: #2f80ed;
  box-shadow: 0 2px 10px rgba(47,128,237,0.35);
}
.speed-btn:hover:not(.active) { background: #d5dbe4; color: #2c3e50; }

/* ── MAIN ─────────────────────────────────────────────────── */
#main { flex: 1; position: relative; overflow: hidden; }
#gameCanvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; cursor: default;
}

/* ── MODE HUD (gauche flottant) ───────────────────────────── */
#mode-hud {
  position: absolute; left: 20px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 10px; z-index: 50;
}
.mode-btn {
  width: 54px; height: 54px;
  background: rgba(255,255,255,0.85); backdrop-filter: blur(10px);
  border: 2px solid rgba(255,255,255,0.9); border-radius: 16px;
  cursor: pointer; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; color: #2c3e50;
  box-shadow: 0 4px 0 rgba(30,100,200,0.25), 0 8px 20px rgba(0,0,0,0.18);
}
.mode-btn:hover {
  background: linear-gradient(135deg, #6cb7ff, #2f80ed);
  color: #fff; border-color: #1c5fb8;
  box-shadow: 0 4px 0 #1c5fb8, 0 8px 20px rgba(47,128,237,0.35);
  transform: translateY(-1px);
}
.mode-btn.active-mode {
  background: linear-gradient(135deg, #6cb7ff, #2f80ed) !important;
  color: #fff !important; border-color: #1c5fb8 !important;
  box-shadow: 0 4px 0 #1c5fb8, 0 8px 20px rgba(47,128,237,0.35) !important;
}
.mode-btn.demolish-mode {
  background: linear-gradient(135deg, #ff4d4d, #cc0000) !important;
  color: #fff !important; border-color: #8b0000 !important;
  box-shadow: 0 4px 0 #8b0000, 0 8px 20px rgba(255,0,0,0.3) !important;
}
/* Label contextuel dans le HUD (mode déplacement / édition) */
#mode-hud span {
  background: rgba(0,0,0,0.55); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.15); border-radius: 10px;
  padding: 6px 10px; text-align: center; font-weight: 700;
  font-family: 'Oxanium', sans-serif; font-size: 10px;
  white-space: nowrap;
}

/* ── ROOM POPUP ───────────────────────────────────────────── */
#room-popup {
  position: fixed;
  z-index: 200;
  pointer-events: auto;
  background: rgba(247,251,255,0.97);
  backdrop-filter: blur(14px);
  border: 1.5px solid rgba(180,210,248,0.9);
  border-radius: 14px;
  padding: 10px 14px 12px;
  min-width: 190px;
  box-shadow: 0 12px 40px rgba(30,80,180,0.14), 0 2px 0 rgba(47,128,237,0.08), inset 0 1px 0 rgba(255,255,255,0.9);
  transform: translate(-50%, -100%);
  animation: popup-in 0.12s ease-out;
}
@keyframes popup-in {
  from { opacity:0; transform: translate(-50%, calc(-100% + 6px)); }
  to   { opacity:1; transform: translate(-50%, -100%); }
}
/* Flèche vers le bas pointant sur la salle */
#room-popup::after {
  content: '';
  position: absolute;
  bottom: -7px; left: calc(50% + var(--arrow-offset, 0px));
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: rgba(247,251,255,0.97);
  border-bottom: none;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.3));
}
.rp-close {
  position: absolute; top: 7px; right: 8px;
  background: none; border: none; color: rgba(100,150,200,0.5);
  font-size: 11px; cursor: pointer; padding: 2px 4px; border-radius: 4px;
  line-height: 1;
}
.rp-close:hover { color: #1a2d42; background: rgba(180,210,240,0.25); }
.rp-title {
  font-family: 'Oxanium', sans-serif; font-weight: 700; font-size: 13px;
  color: #1a2d42; margin-bottom: 3px; padding-right: 18px;
}
.rp-stats {
  font-size: 10px; color: #4a7fa5; margin-bottom: 10px;
  font-family: 'Oxanium', sans-serif;
}
.rp-actions {
  display: flex; gap: 6px;
}
.rp-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: rgba(240,247,255,0.8); border: 1.5px solid rgba(180,210,248,0.8);
  border-radius: 10px; padding: 7px 4px 6px; cursor: pointer;
  transition: all 0.12s; color: #2563b0;
}
.rp-btn:hover {
  background: rgba(47,128,237,0.12); border-color: rgba(47,128,237,0.5);
  color: #1a4fa0; transform: translateY(-1px);
}
.rp-btn > span { font-size: 9px; font-family: 'Oxanium',sans-serif; font-weight: 600; }
.rp-btn-danger { color: #c0392b; border-color: rgba(231,76,60,0.3); }
.rp-btn-danger:hover { background: rgba(231,76,60,0.12); border-color: rgba(231,76,60,0.6); color: #a93226; }

/* ── GAME OVER OVERLAY ────────────────────────────────────── */
#gameover-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  animation: fadein 0.5s ease;
}
#gameover-overlay.gameover-lose { background: rgba(120,20,20,0.72); backdrop-filter: blur(6px); }
#gameover-overlay.gameover-win  { background: rgba(20,80,20,0.72);  backdrop-filter: blur(6px); }

#gameover-box {
  background: rgba(247,251,255,0.97);
  border-radius: 24px;
  padding: 40px 48px;
  text-align: center;
  min-width: 340px;
  max-width: 460px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.9);
  animation: popup-in 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
}
#gameover-icon { font-size: 64px; line-height: 1; margin-bottom: 12px; }
#gameover-title {
  font-family: 'Oxanium', sans-serif; font-weight: 800; font-size: 32px;
  margin: 0 0 6px; letter-spacing: 3px;
}
.gameover-lose #gameover-title { color: #c0392b; }
.gameover-win  #gameover-title { color: #1a7a2a; }

#gameover-sub {
  font-size: 14px; color: #4a7fa5; margin: 0 0 20px;
}
#gameover-stats {
  background: rgba(230,242,255,0.7); border-radius: 12px;
  padding: 14px 20px; margin-bottom: 24px; text-align: left;
}
.go-stat {
  font-size: 13px; color: #1a2d42; padding: 3px 0;
  font-family: 'Oxanium', sans-serif;
}
.go-stat b { color: #2563b0; }

@keyframes fadein { from { opacity:0; } to { opacity:1; } }

/* ── BOTTOM NAV ───────────────────────────────────────────── */
#bottom-nav {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 10px; z-index: 50;
  background: rgba(255,255,255,0.88); backdrop-filter: blur(12px);
  border: 1.5px solid rgba(255,255,255,0.95); border-radius: 22px;
  padding: 10px 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2), 0 4px 0 rgba(30,100,200,0.15);
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: rgba(255,255,255,0.7); border: 1.5px solid rgba(210,220,240,0.8);
  border-radius: 14px; padding: 8px 14px; cursor: pointer; color: #7f8c8d;
  transition: all 0.18s; min-width: 58px;
  font-family: 'Oxanium', sans-serif; font-size: 10px; font-weight: 700;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.nav-btn .nav-icon { font-size: 22px; line-height: 1; }
.nav-btn:hover, .nav-btn.nav-active {
  background: linear-gradient(135deg, #6cb7ff, #2f80ed);
  border-color: #1c5fb8; color: #fff;
  box-shadow: 0 4px 0 #1c5fb8, 0 8px 20px rgba(47,128,237,0.35);
  transform: translateY(-2px);
}

/* ── PANEL MODAL (centré) ─────────────────────────────────── */
#panel-overlay {
  position: fixed; inset: 0;
  background: rgba(30,60,120,0.45); backdrop-filter: blur(10px);
  z-index: 300; display: none;
  align-items: center; justify-content: center;
  padding: 20px;
}
#panel-overlay.open { display: flex; }

#panel-drawer {
  background: rgba(247,251,255,0.97);
  border: 1.5px solid rgba(210,228,248,0.9);
  border-radius: 20px;
  display: flex; flex-direction: column;
  width: 100%; max-width: 580px;
  max-height: calc(100vh - 100px);
  box-shadow: 0 24px 64px rgba(30,80,180,0.18), 0 4px 0 rgba(47,128,237,0.12), inset 0 1px 0 rgba(255,255,255,0.9);
  animation: modal-in 0.22s cubic-bezier(0.34,1.3,0.64,1);
}
#panel-drawer.panel-wide { max-width: 960px; }
@keyframes modal-in {
  from { opacity:0; transform:scale(0.93) translateY(12px); }
  to   { opacity:1; transform:scale(1)    translateY(0);    }
}

#panel-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 16px; border-bottom: 1px solid rgba(200,220,245,0.7);
  flex-shrink: 0;
}
#panel-drawer-title {
  font-family: 'Oxanium', sans-serif; font-size: 16px;
  font-weight: 800; color: #1a2d42; letter-spacing: 0.5px;
}
#panel-drawer-close {
  background: rgba(200,220,245,0.4); border: 1px solid rgba(200,220,245,0.7);
  border-radius: 10px; width: 34px; height: 34px; cursor: pointer;
  color: #6a96be; font-size: 16px; transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
#panel-drawer-close:hover { background: rgba(231,76,60,0.1); color: #e74c3c; border-color: rgba(231,76,60,0.35); }

#panel-content { flex: 1; overflow-y: auto; padding: 20px 22px; }
#panel-content::-webkit-scrollbar { width: 4px; }
#panel-content::-webkit-scrollbar-track { background: transparent; }
#panel-content::-webkit-scrollbar-thumb { background: rgba(180,210,240,0.7); border-radius: 99px; }

.panel-wide #panel-content,
.panel-tabbed #panel-content { display:flex; flex-direction:column; overflow:hidden; padding:0; min-height:0; }

/* ── SECTION TITLES ───────────────────────────────────────── */
.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: #7fa8c8;
  margin: 14px 0 8px; font-family: 'Oxanium', sans-serif;
}
.section-title:first-child { margin-top: 0; }
.section-title::after { content: ''; flex: 1; height: 1px; background: rgba(180,210,240,0.6); }

/* ── CARDS ────────────────────────────────────────────────── */
.card {
  background: rgba(255,255,255,0.82); border: 1.5px solid rgba(210,228,248,0.85); border-radius: 12px;
  padding: 12px; margin-bottom: 8px; cursor: pointer;
  transition: all 0.18s; position: relative; overflow: hidden;
  box-shadow: 0 2px 8px rgba(30,80,180,0.06);
}
.card::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.5) 0%, transparent 60%);
  pointer-events: none;
}
.card:hover { border-color: #2f80ed; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(47,128,237,0.15); }
.card.selected { border-color: #2f80ed; background: rgba(240,248,255,0.95); box-shadow: 0 0 0 2px rgba(47,128,237,0.2); }
.card-title { font-size: 13px; font-weight: 800; color: #1a2d42; margin-bottom: 4px; font-family: 'Oxanium', sans-serif; }
.card-desc  { font-size: 10px; color: #5a90b8; margin-bottom: 5px; line-height: 1.5; }
.card-stats { font-size: 10px; color: #7facc8; }
.card-cost  { font-size: 12px; color: #1e9e52; font-weight: 800; font-family: 'Oxanium', sans-serif; }
.card-cost.bad { color: #e74c3c; }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn {
  background: rgba(255,255,255,0.85); border: 1.5px solid rgba(200,220,245,0.8);
  color: #4a7fa5; padding: 7px 12px; border-radius: 9px; cursor: pointer;
  font-size: 11px; font-family: 'Oxanium', sans-serif; font-weight: 700;
  letter-spacing: 0.3px; width: 100%; margin-bottom: 5px; transition: all 0.15s;
  box-shadow: 0 2px 6px rgba(30,80,180,0.07);
}
.btn:hover { background: rgba(240,247,255,0.95); border-color: #5a9fd8; color: #1a5080; }
.btn.primary {
  background: linear-gradient(135deg, #1e6fc2, #2f80ed);
  border-color: #2f80ed; color: #fff; box-shadow: 0 4px 14px rgba(47,128,237,0.35);
}
.btn.primary:hover { background: linear-gradient(135deg, #2f80ed, #5299f0); transform: scale(1.01); }
.btn.danger  { background: rgba(231,76,60,0.07); border-color: rgba(231,76,60,0.3); color: #c0392b; }
.btn.danger:hover { background: rgba(231,76,60,0.15); border-color: #e74c3c; }
.btn:disabled { opacity: 0.38; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ── PROGRESS BARS ────────────────────────────────────────── */
.progress-bar { height: 5px; background: rgba(200,220,240,0.5); border-radius: 99px; overflow: hidden; margin: 4px 0; }
.progress-fill { height: 100%; border-radius: 99px; transition: width 0.3s; }
.pf-green { background: #2ecc71; } .pf-yellow { background: #f39c12; }
.pf-red   { background: #e74c3c; } .pf-blue   { background: #2f80ed; }

/* ── TOASTS ───────────────────────────────────────────────── */
#notifications {
  position: fixed; top: 74px; left: 18px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 999; pointer-events: none;
}
.notif {
  padding: 10px 18px; border-radius: 10px; font-size: 13px; font-weight: 600;
  font-family: 'Inter', sans-serif; box-shadow: 0 4px 18px rgba(0,0,0,0.18);
  border-left: 4px solid transparent; max-width: 340px;
  animation: t-in 0.25s ease, t-out 0.3s ease 3.7s forwards;
}
.notif.success { background: #eafaf1; border-color: #2ecc71; color: #1a7a43; }
.notif.warning { background: #fef9e7; border-color: #f39c12; color: #7d5a00; }
.notif.error   { background: #fdf0f0; border-color: #e74c3c; color: #922b21; }
.notif.info    { background: #eaf4fd; border-color: #3498db; color: #1a5276; }
@keyframes t-in  { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: translateX(0); } }
@keyframes t-out { to   { opacity: 0; transform: translateX(-18px); } }

/* Notification d'attaque — même style que .notif, cliquable */
.notif-attack {
  padding: 10px 18px; border-radius: 10px; font-size: 13px; font-weight: 600;
  font-family: 'Inter', sans-serif; box-shadow: 0 4px 18px rgba(0,0,0,0.18);
  border-left: 4px solid #e74c3c; max-width: 340px;
  background: #fdf0f0; color: #922b21;
  animation: t-in 0.25s ease;
  pointer-events: auto; cursor: pointer;
  position: relative; overflow: hidden;
}
.notif-attack:hover { filter: brightness(0.95); }
.notif-attack-sub  { font-size: 11px; color: #c0392b; margin-top: 2px; }
.notif-attack-cta  { font-size: 10px; color: #e74c3c; margin-top: 4px; font-weight: 700; letter-spacing: 0.5px; }
.notif-attack-close {
  position: absolute; top: 5px; right: 8px;
  font-size: 13px; color: #c0392b; cursor: pointer; padding: 2px 4px;
}
.notif-attack-bar {
  position: absolute; bottom: 0; left: 0; height: 3px;
  background: #e74c3c; width: 100%; transition: width 1s linear;
}

/* ── MODAL (confirm) ──────────────────────────────────────── */
#modal-overlay {
  position: fixed; inset: 0; background: rgba(8,15,28,0.6);
  backdrop-filter: blur(6px); z-index: 500;
  display: none; align-items: center; justify-content: center;
}
#modal-overlay.open { display: flex; }
#modal {
  background: rgba(247,251,255,0.97); border: 1.5px solid rgba(210,228,248,0.9); border-radius: 20px;
  padding: 26px; min-width: 360px; max-width: 480px; color: #1a2d42;
  box-shadow: 0 24px 64px rgba(30,80,180,0.18), 0 4px 0 rgba(47,128,237,0.12), inset 0 1px 0 rgba(255,255,255,0.9);
}
#modal h2 { margin-bottom: 14px; font-size: 18px; font-family: 'Oxanium', sans-serif; font-weight: 800; color: #1a2d42; }
#modal p  { color: #5a90b8; font-size: 13px; line-height: 1.6; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { margin: 0; flex: 1; }

/* ── INPUTS ───────────────────────────────────────────────── */
input[type="number"], input[type="text"], input[type="email"], input[type="password"] {
  background: rgba(255,255,255,0.9); border: 1.5px solid rgba(200,220,245,0.8); color: #1a2d42;
  padding: 8px 12px; border-radius: 9px; width: 100%;
  font-size: 13px; font-family: 'Inter', sans-serif; margin: 6px 0;
  outline: none; transition: border-color 0.15s;
  box-shadow: inset 0 1px 3px rgba(30,80,180,0.06);
}
input::placeholder { color: #a0bcce; }
input:focus { border-color: #2f80ed; background: #fff; }

/* ── EMPLOYEE ITEMS ───────────────────────────────────────── */
.eitem { background: rgba(255,255,255,0.8); border: 1.5px solid rgba(210,228,248,0.85); border-radius: 10px; padding: 11px; margin-bottom: 8px; box-shadow: 0 2px 6px rgba(30,80,180,0.05); }
.eitem .ename { font-size: 13px; font-weight: 800; color: #1a2d42; font-family: 'Oxanium', sans-serif; }
.eitem .erole { font-size: 10px; color: #5a90b8; }
.flex-row { display: flex; justify-content: space-between; align-items: center; }

/* ── CLIENT TABS ───────────────────────────────────────── */
.ctab-bar {
  display: flex; padding: 0 20px; gap: 2px; flex-shrink: 0;
  border-bottom: 1.5px solid rgba(180,210,240,0.5);
  background: rgba(240,247,255,0.5);
}
.ctab {
  padding: 10px 15px; border: none; background: transparent;
  font-size: 12px; font-weight: 600; color: #4a7fa5; cursor: pointer;
  font-family: 'Inter', sans-serif; white-space: nowrap;
  display: flex; align-items: center; gap: 5px;
  border-bottom: 2px solid transparent; margin-bottom: -1.5px;
  transition: color 0.15s;
}
.ctab:hover { color: #2f80ed; }
.ctab.active { color: #1a2d42; border-bottom-color: #2f80ed; font-weight: 700; }
.ctab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 15px; padding: 0 4px; border-radius: 8px;
  background: rgba(47,128,237,0.15); color: #2f80ed;
  font-size: 9px; font-weight: 700;
}
.ctab.active .ctab-badge { background: #2f80ed; color: white; }
.ctab-content { flex: 1; overflow-y: auto; padding: 16px 20px; min-height: 0; }
.ctab-content::-webkit-scrollbar { width: 4px; }
.ctab-content::-webkit-scrollbar-track { background: transparent; }
.ctab-content::-webkit-scrollbar-thumb { background: rgba(180,210,240,0.7); border-radius: 99px; }
.cap-banner {
  background: rgba(47,128,237,0.05); border: 1px solid rgba(180,210,240,0.6);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 14px;
}
.eitem-risk { border: 1px solid rgba(231,76,60,0.35) !important; background: rgba(231,76,60,0.04) !important; }
.pr-btn { margin: 0; display: flex; justify-content: space-between; align-items: center; font-size: 11px; padding: 9px 12px; }
.pr-btn-label { font-weight: 600; }
.pr-btn-cost { display: flex; gap: 10px; font-size: 10px; font-weight: 700; }

.rep-card {
  background: rgba(255,255,255,0.95);
  border: 1.5px solid rgba(210,228,248,0.95);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(30,80,180,0.08);
}
.rep-card-top { display:flex; justify-content:space-between; gap:16px; align-items:flex-start; }
.rep-score { font-size: 28px; font-weight: 900; line-height: 1; font-family: 'Oxanium', sans-serif; }
.rep-score span { font-size: 12px; margin-left: 4px; color: rgba(60,80,110,0.8); }
.rep-label { font-size: 12px; margin-top: 6px; color: #4a7fa5; }
.rep-info-row { display:flex; justify-content:space-between; gap:10px; font-size: 10px; color: #4a7fa5; margin-top: 6px; }
.rep-gauge-track { background: rgba(200,220,245,0.6); border-radius: 99px; height: 10px; margin-top: 12px; overflow:hidden; }
.rep-gauge-fill { height: 100%; transition: width 0.35s ease; }

.client-tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}

/* ── TAGS ─────────────────────────────────────────────────── */
.tag { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 10px; margin: 2px; font-weight: 700; }
.tag.blue   { background: rgba(52,152,219,0.12); color: #2471a3; border: 1px solid rgba(52,152,219,0.25); }
.tag.green  { background: rgba(46,204,113,0.12); color: #1e8449; border: 1px solid rgba(46,204,113,0.25); }
.tag.yellow { background: rgba(243,156,18,0.12); color: #b7770d; border: 1px solid rgba(243,156,18,0.25); }
.tag.red    { background: rgba(231,76,60,0.1);   color: #c0392b; border: 1px solid rgba(231,76,60,0.22); }
.help-text  { font-size: 10px; color: #5a90b8; margin: 5px 0 8px; line-height: 1.6; }

/* ── R&D — SKILL TREE ────────────────────────────────────── */
@keyframes pulse-research { 0%,100% { box-shadow: 0 0 0 0 rgba(124,58,237,0.2); } 50% { box-shadow: 0 0 16px 5px rgba(124,58,237,0.3); } }
@keyframes pulse-done     { 0%,100% { box-shadow: 0 0 0 0 rgba(46,204,113,0.15); }  50% { box-shadow: 0 0 12px 3px rgba(46,204,113,0.28); } }

/* Layout 2 colonnes */
.research-layout { display:flex; gap:18px; height:100%; min-height:0; }
.research-tree-col { flex:1; min-width:0; overflow-y:auto; }
.research-tree-col::-webkit-scrollbar { width:3px; }
.research-tree-col::-webkit-scrollbar-thumb { background:rgba(180,210,240,0.7); border-radius:99px; }
.research-detail-col { width:260px; flex-shrink:0; overflow-y:auto; }
.research-detail-col::-webkit-scrollbar { width:3px; }
.research-detail-col::-webkit-scrollbar-thumb { background:rgba(180,210,240,0.7); border-radius:99px; }

.panel-wide .research-layout { flex:1; overflow:hidden; padding:16px 20px; }
.panel-wide .research-detail-col { overflow-y:auto; }

/* Placeholder détail */
.detail-placeholder { height:100%; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; color:#b0c8dc; text-align:center; border:1.5px dashed rgba(180,210,240,0.6); border-radius:14px; }
.detail-placeholder .dp-icon { font-size:32px; }
.detail-placeholder .dp-text { font-size:10px; font-family:'Oxanium',sans-serif; letter-spacing:1px; text-transform:uppercase; }

/* Header RP */
.rp-header { display:flex; gap:12px; align-items:flex-start; background:rgba(124,58,237,0.05); border:1px solid rgba(124,58,237,0.18); border-radius:12px; padding:12px 14px; margin-bottom:14px; }
.rph-left  { flex:1; }
.rph-rp    { font-family:'Oxanium',sans-serif; font-size:22px; font-weight:800; color:#7c3aed; line-height:1; }
.rph-rp span { font-size:13px; color:#9b59b6; }
.rph-rate  { font-size:10px; color:#7a9bb8; margin-top:4px; }
.rph-active { flex:1; border-left:1px solid rgba(180,210,240,0.6); padding-left:12px; }
.rpha-title { font-size:11px; color:#1a2d42; font-weight:700; margin-bottom:5px; font-family:'Oxanium',sans-serif; }
.rpha-bar   { height:6px; background:rgba(200,220,240,0.45); border-radius:99px; overflow:hidden; margin-bottom:4px; }
.rpha-fill  { height:100%; background:linear-gradient(90deg,#7c3aed,#c084fc); border-radius:99px; transition:width 0.4s; }
.rpha-meta  { font-size:9px; color:#7a9bb8; }
.rph-none   { flex:1; border-left:1px solid rgba(180,210,240,0.6); padding-left:12px; font-size:10px; color:#a0bcce; display:flex; align-items:center; font-style:italic; }

/* ── Grid layout ─────────────────────────────────────────── */
.st-grid { display:flex; flex-direction:column; padding:4px 0 8px; }

/* Branch headers */
.st-row-heads { display:flex; gap:4px; margin-bottom:14px; }
.st-col-head { flex:1; text-align:center; padding:7px 3px 9px; border-bottom:2px solid var(--bc); display:flex; flex-direction:column; align-items:center; gap:3px; }
.st-head-icon { font-size:16px; line-height:1; }
.st-head-name { font-size:8px; font-weight:800; font-family:'Oxanium',sans-serif; color:var(--bc); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:90px; }
.st-head-prog { font-size:8px; color:#7a9bb8; }

/* Columns */
.st-cols { display:flex; gap:4px; }
.st-col  { flex:1; display:flex; flex-direction:column; align-items:center; min-width:0; }
.st-cell { display:flex; flex-direction:column; align-items:center; width:100%; }

/* Connector */
.st-conn { width:3px; height:22px; background:rgba(180,210,240,0.35); margin:3px 0; border-radius:99px; transition:background 0.3s; }
.st-conn.stc-done   { background:rgba(46,204,113,0.6); }
.st-conn.stc-active { background:rgba(124,58,237,0.55); }

/* Node circle */
.st-node {
  position:relative; width:66px; height:66px; border-radius:50%;
  border:2.5px solid rgba(180,210,240,0.5); background:#fff;
  box-shadow:0 2px 8px rgba(30,80,180,0.08);
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  cursor:pointer; transition:transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s;
  flex-shrink:0; text-align:center; overflow:visible;
}
.st-node.stn-done   { border-color:rgba(46,204,113,0.65); background:rgba(46,204,113,0.07); animation:pulse-done 3s ease-in-out infinite; cursor:default; }
.st-node.stn-active { border-color:rgba(124,58,237,0.65); background:rgba(124,58,237,0.06); animation:pulse-research 2s ease-in-out infinite; }
.st-node.stn-avail  { border-color:var(--bc); }
.st-node.stn-avail:hover { transform:scale(1.1); box-shadow:0 6px 22px rgba(80,100,220,0.22); }
.st-node.stn-done:hover  { transform:scale(1.05); }
.st-node.stn-locked { opacity:0.32; cursor:not-allowed; }
.st-node.stn-sel    { outline:2.5px solid #7c3aed; outline-offset:5px; }

/* Node contents */
.stn-icon { font-size:22px; line-height:1; pointer-events:none; }
.stn-cost { font-size:7px; color:#96b4cc; pointer-events:none; margin-top:2px; font-family:'Oxanium',sans-serif; }
.stn-badge {
  position:absolute; top:-7px; right:-7px;
  background:#f0f6fc; border:1px solid rgba(180,210,240,0.7);
  border-radius:10px; padding:1px 5px;
  font-size:8px; font-weight:800; font-family:'Oxanium',sans-serif; z-index:2;
}

/* Label below node */
.stn-label {
  font-size:8px; font-weight:700; color:#4a7fa5; font-family:'Oxanium',sans-serif;
  text-align:center; line-height:1.3; margin-top:5px; padding:0 2px;
  max-width:100%; word-break:break-word;
  display:-webkit-box; -webkit-line-clamp:2; line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
  min-height:2.5em;
}
.stn-label-done { color:#1e8449; }
.stn-label-act  { color:#7c3aed; }
.stn-label-lock { color:#a0b8cc; }

/* SVG progress ring (active research) */
.stn-ring { position:absolute; top:-4px; left:-4px; width:calc(100% + 8px); height:calc(100% + 8px); pointer-events:none; overflow:visible; }

/* Detail panel */
.tech-detail-panel { background:rgba(255,255,255,0.92); border:1.5px solid rgba(210,228,248,0.85); border-radius:14px; padding:16px; animation:fadeIn 0.15s ease; height:100%; box-shadow:0 4px 16px rgba(30,80,180,0.08); }
@keyframes fadeIn { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:translateY(0); } }
.tdp-title  { font-size:14px; font-weight:800; color:#1a2d42; font-family:'Oxanium',sans-serif; }
.tdp-branch { font-size:9px; color:#96b4cc; font-family:'Oxanium',sans-serif; text-transform:uppercase; letter-spacing:1px; margin-top:1px; }
.tdp-desc   { font-size:11px; color:#4a7fa5; line-height:1.6; margin-bottom:6px; }
.tdp-effect { font-size:10px; color:#7c3aed; font-style:italic; margin-bottom:8px; }
.tdp-row    { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:6px; }
.tdp-unlock-badge { background:rgba(124,58,237,0.08); color:#7c3aed; border:1px solid rgba(124,58,237,0.25); border-radius:6px; padding:2px 8px; font-size:9px; font-weight:700; }
.tdp-meta   { font-size:10px; color:#7a9bb8; line-height:1.8; }
.tdp-actions{ margin-top:10px; display:flex; gap:8px; flex-wrap:wrap; }

/* Legacy (used in other panels) */
.rp-tag { display:inline-block; background:rgba(124,58,237,0.08); color:#7c3aed; border:1px solid rgba(124,58,237,0.25); border-radius:99px; padding:2px 9px; font-size:10px; font-weight:700; }
.rp-bar { background:rgba(124,58,237,0.05); border:1px solid rgba(124,58,237,0.18); border-radius:10px; padding:10px 14px; margin-bottom:10px; display:flex; justify-content:space-between; align-items:center; }
.rp-value { color:#7c3aed; font-size:17px; font-weight:800; font-family:'Oxanium',sans-serif; }
.rp-rate  { color:#7a9bb8; font-size:10px; margin-top:2px; }
.tech-prereq { font-size:9px; color:#96b4cc; margin-top:3px; }
.tech-effect { font-size:10px; color:#7c3aed; margin-top:3px; font-style:italic; }

/* ── HELP OVERLAY ─────────────────────────────────────────── */
#help-overlay { position: fixed; inset: 0; background: rgba(10,20,50,0.75); backdrop-filter: blur(8px); z-index: 400; display: flex; align-items: center; justify-content: center; }
#help-box { background: rgba(247,251,255,0.97); border: 1.5px solid rgba(210,228,248,0.9); border-radius: 20px; padding: 30px; max-width: 540px; width: 90%; box-shadow: 0 24px 64px rgba(30,80,180,0.18), 0 4px 0 rgba(47,128,237,0.12), inset 0 1px 0 rgba(255,255,255,0.9); }
#help-box h1 { color: #1a2d42; margin-bottom: 14px; font-size: 24px; font-family: 'Oxanium', sans-serif; font-weight: 800; letter-spacing: 1px; }
#help-box p  { color: #5a90b8; margin-bottom: 10px; font-size: 13px; line-height: 1.6; }
#help-box ul { margin: 8px 0 12px 20px; line-height: 2.2; color: #4a7fa5; font-size: 13px; }
#help-box .hint { background: rgba(240,248,255,0.8); border: 1px solid rgba(210,228,248,0.9); border-radius: 9px; padding: 11px 14px; margin: 8px 0; font-size: 11px; color: #5a90b8; line-height: 1.6; }

/* ── LOGIN PAGE ───────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #4dafff 0%, #87cefa 45%, #cfefff 100%);
}
.login-box {
  background: #0f1923; border: 1.5px solid #1e3a5f; border-radius: 20px;
  padding: 36px; width: 380px; box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
.login-box h1 { font-family: 'Oxanium', sans-serif; font-size: 22px; font-weight: 800; color: #2f80ed; margin-bottom: 6px; }
.login-box .subtitle { color: #4a7fa5; font-size: 13px; margin-bottom: 24px; }
.login-tabs { display: flex; gap: 6px; margin-bottom: 20px; }
.login-tab { flex: 1; padding: 8px; border: 1px solid #1e3a5f; border-radius: 9px; background: transparent; color: #4a7fa5; cursor: pointer; font-family: 'Oxanium', sans-serif; font-size: 12px; font-weight: 700; transition: all 0.15s; }
.login-tab.active { background: linear-gradient(135deg, #1e6fc2, #2f80ed); border-color: #2f80ed; color: #fff; }
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 11px; color: #4a7fa5; margin-bottom: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
#login-error { color: #e74c3c; font-size: 12px; margin-top: 8px; min-height: 18px; }

/* ── VERSUS — ATTAQUES COOLDOWN & UNLOCK ──────────────────── */
.vp-malus-btn { position: relative; overflow: hidden; }
.vp-malus-btn.on-cooldown { opacity: 0.55; cursor: not-allowed; }
.vp-malus-btn.locked      { cursor: pointer; }
.vp-malus-btn.locked::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; z-index: 1;
  background: rgba(100,40,220,0.18);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.vp-cooldown-overlay {
  position: absolute; inset: 0; background: rgba(30,50,80,0.55);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: inherit; font-size: 11px; font-weight: 700; color: #fff;
  pointer-events: none;
}
.vp-cooldown-bar {
  position: absolute; bottom: 0; left: 0; height: 3px;
  background: #2f80ed; transition: width 1s linear;
}
.vp-lock-badge {
  position: absolute; top: 4px; right: 5px; z-index: 2;
  font-size: 9px; background: rgba(124,58,237,0.22); color: #6d28d9;
  border-radius: 6px; padding: 1px 5px; font-weight: 800;
  border: 1px solid rgba(124,58,237,0.4);
}
.vp-malus-btn:not(.locked) .vp-lock-badge { display: none; }
.vp-opp-offline { font-size: 10px; color: #e74c3c; text-align: center; margin: 4px 0; font-weight: 700; animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 0%,100% { opacity:1; } 50% { opacity:0.4; } }

/* ── MINI-JEU DÉFENSE ────────────────────────────────────── */
#minigame-overlay {
  position: fixed; inset: 0; background: rgba(8,15,28,0.82);
  backdrop-filter: blur(8px); z-index: 600;
  display: none; align-items: center; justify-content: center;
}
#minigame-overlay.open { display: flex; }
#minigame-box {
  background: rgba(247,251,255,0.97); border: 2px solid rgba(231,76,60,0.4);
  border-radius: 20px; padding: 28px 32px; min-width: 340px; max-width: 420px;
  box-shadow: 0 24px 64px rgba(180,30,30,0.22), inset 0 1px 0 rgba(255,255,255,0.9);
  text-align: center;
}
#minigame-title { font-family: 'Oxanium', sans-serif; font-weight: 800; font-size: 18px; color: #c0392b; margin-bottom: 4px; }
#minigame-sub   { font-size: 11px; color: #5a90b8; margin-bottom: 16px; }
#minigame-timer-bar { height: 6px; background: rgba(200,220,240,0.5); border-radius: 99px; overflow: hidden; margin-bottom: 20px; }
#minigame-timer-fill { height: 100%; background: linear-gradient(90deg, #e74c3c, #f39c12); border-radius: 99px; transition: width 0.2s linear; }
#minigame-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin-bottom: 16px;
}
.mg-btn {
  aspect-ratio: 1; border-radius: 12px; border: 2px solid rgba(47,128,237,0.3);
  background: rgba(240,248,255,0.9); font-family: 'Oxanium', sans-serif;
  font-size: 22px; font-weight: 800; color: #1a2d42; cursor: pointer;
  transition: transform 0.1s, background 0.1s;
  display: flex; align-items: center; justify-content: center;
}
.mg-btn:hover   { background: rgba(47,128,237,0.12); transform: scale(1.06); }
.mg-btn.correct { background: rgba(46,204,113,0.2); border-color: #2ecc71; color: #1e8449; }
.mg-btn.wrong   { background: rgba(231,76,60,0.15); border-color: #e74c3c; animation: shake 0.3s; }
@keyframes shake { 0%,100% { transform:translateX(0); } 25% { transform:translateX(-4px); } 75% { transform:translateX(4px); } }
#minigame-skip  { font-size: 10px; color: #a0bcce; background: none; border: none; cursor: pointer; text-decoration: underline; padding: 0; }
.mg-result-icon { font-size: 52px; margin-bottom: 10px; }
.mg-result-msg  { font-family: 'Oxanium', sans-serif; font-size: 16px; font-weight: 800; }
