/* [10-hud-top] Ruban bordeaux et HUD supérieur (ressources, fiche joueur, navigation) */
/* ==========================================================================
   1. RUBAN BORDEAUX DE CONTRÔLE (langue, invitation, annonces, heure, serveur)
   ========================================================================== */
#upper-bar {
  position: relative;
  z-index: 120;
  flex-shrink: 0;
  height: 46px;
  padding: 8px 0 6px;
  font-family: 'Limelight', Georgia, serif;
}
/* bannière : charbon à éventails laiton derrière le ruban */
#upper-bar::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--deco-fans) 0 0 / 40px 20px, var(--deco-charcoal);
  border-bottom: 3px double var(--deco-brass);
}
.upper-bar-inner {
  width: var(--frame-w, 980px);
  max-width: 100%;
  height: 100%;
  margin: 0 auto;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.1) 0 2px, transparent 2px 5px),
    linear-gradient(180deg, #1c4839 0%, #112e24 100%);
  border: 1px solid #071510;
  border-bottom: none;
  box-shadow: inset 0 1px 0 rgba(234, 123, 111, 0.18), 0 -2px 6px rgba(0, 0, 0, 0.6);
}

/* cases ivoire (parchemin) */
.upper-parchment,
.lang-select,
.ticker-ribbon {
  background: linear-gradient(180deg, #f7f2ec 0%, #e0d6ca 100%);
  border: 1px solid #0d211a;
  box-shadow: 0 0 0 2px rgba(43, 98, 79, 0.55), inset 0 1px 2px rgba(0, 0, 0, 0.25);
  color: #251f17;
}
.lang-select {
  height: 22px;
  padding: 0 4px;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 12px;
  border-radius: 0;
  cursor: pointer;
}
.btn-upper-red,
.ticker-more-btn,
.server-name {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 12px;
  background: linear-gradient(180deg, #b34235 0%, #7a241a 100%);
  border: 1px solid #0d211a;
  box-shadow: 0 0 0 2px rgba(43, 98, 79, 0.55), inset 0 1px 0 rgba(242, 171, 163, 0.35);
  color: #f4ebdf;
  font-family: 'Limelight', Georgia, serif;
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
  border-radius: 0;
  cursor: pointer;
  white-space: nowrap;
}
.btn-upper-red:hover,
.ticker-more-btn:hover { filter: brightness(1.15); }

.ticker-ribbon {
  flex: 1;
  min-width: 0;
  height: 22px;
  display: flex;
  align-items: center;
  padding: 0 0 0 12px;
  gap: 0;
  border-radius: 0;
  font-size: 12px;
  letter-spacing: 0;
}
.ticker-text { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: center; }
.ticker-ribbon .ticker-more-btn { box-shadow: inset 0 1px 0 rgba(242, 171, 163, 0.35); margin: -1px -1px -1px 8px; }

#upper-clock-display {
  min-width: 82px;
  height: 22px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Limelight', Georgia, serif;
  font-size: 12px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: #251f17;
}
.server-pill-btn { display: flex; border: none; border-radius: 0; overflow: visible; }
.server-badge {
  height: 22px;
  min-width: 90px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
.server-name { box-shadow: inset 0 1px 0 rgba(242, 171, 163, 0.35); cursor: default; }

/* boutons audio d'origine : pilotés depuis les petits boutons du HUD */
.upper-audio { display: none; }
.audio-toggle-btn.muted { opacity: 0.5; }

/* ==========================================================================
   2. HUD SUPÉRIEUR
   - Bandeau noir : filet rouge en haut, liseré or en bas, motif Art déco discret
   - Fiche joueur à gauche : portrait rectangulaire fondu, bord droit en diagonale dorée,
     rangées blason+nom / pistolet+Respect / étoile+Influence, barre rouge de niveau
   - Rangée de navigation (ville) qui prolonge la diagonale
   Mesures relevées sur la vidéo, ramenées au cadre 980 × 640.
   ========================================================================== */
#main-top-hud {
  --hud-bar-h: 27px;
  --hud-gold: #93764f;
  --hud-gold-hi: #ceb28e;
  --hud-text: #f2f2f2;
  --hud-deco: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M0 24 12 12 24 24M0 12 12 0 24 12M12 0v24' fill='none' stroke='%23c9a24a' stroke-opacity='.09' stroke-width='1'/%3E%3C/svg%3E");
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0;
  z-index: 110;
  font-family: 'Josefin Sans', 'Gill Sans', 'Trebuchet MS', sans-serif;
  font-variant-numeric: tabular-nums;
  color: var(--hud-text);
}

/* ---------- Bandeau des ressources ---------- */
#main-top-hud .hud-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--hud-bar-h);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  padding: 1px 6px 0 0;
  background:
    var(--hud-deco) 0 0 / 24px 24px,
    linear-gradient(180deg, #131415 0%, var(--ink-black) 100%);
  border-top: 3px solid #2c715a;
  border-bottom: 2px solid var(--hud-gold);
  box-shadow: inset 0 1px 0 rgba(232, 107, 93, 0.25), 0 2px 5px rgba(0, 0, 0, 0.75);
}

/* 3 petits boutons à cheval sur le liseré, comme l'original */
#main-top-hud .hud-tools {
  position: absolute;
  top: 11px;
  left: 216px;
  z-index: 2;
  display: flex;
  gap: 3px;
}
#main-top-hud .hud-tool-btn {
  width: 17px;
  height: 17px;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #3a3a3a 0%, #161616 100%);
  border: 1px solid #5c5c5c;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  color: #a9a9a9;
  cursor: pointer;
}
#main-top-hud .hud-tool-btn svg { width: 11px; height: 11px; fill: currentColor; }
#main-top-hud .hud-tool-btn:hover { color: #fff; border-color: #8a8a8a; }
#main-top-hud .hud-tool-btn.muted { color: #5a5a5a; }

#main-top-hud .resources-cluster {
  display: flex;
  align-items: center;
  height: 100%;
  margin-left: 282px;
}

#main-top-hud .resource-cell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 3px;
  width: 134px;
  height: 100%;
}

#main-top-hud .res-plus {
  width: 11px;
  height: 11px;
  margin-right: 1px;
  flex-shrink: 0;
  cursor: pointer;
  filter: drop-shadow(0 1px 1px #000);
}
#main-top-hud .res-plus:hover { filter: brightness(1.1) drop-shadow(0 0 3px rgba(231, 99, 84, 0.8)); }

#main-top-hud .res-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.9));
}

#main-top-hud .res-num {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--hud-text);
  letter-spacing: 0.2px;
  white-space: nowrap;
  text-shadow: 0 1px 1px #000;
}

/* production horaire : bulle au survol */
#main-top-hud .res-rate {
  position: absolute;
  top: calc(100% + 4px);
  left: 20px;
  padding: 1px 6px;
  background: rgba(6, 5, 4, 0.94);
  border: 1px solid var(--hud-gold);
  border-radius: 2px;
  font-size: 10px;
  font-weight: 700;
  color: #7ad4b3;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
#main-top-hud .res-rate.negative { color: #ed8b80; }
/* la production horaire est affichée dans l'infobulle (js/tooltip.js) */
#main-top-hud .res-rate { display: none; }

#main-top-hud .hud-diamonds {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 18px;
}
#main-top-hud .hud-diamonds .res-icon { filter: saturate(0) brightness(1.1) drop-shadow(0 1px 1px #000); }

#main-top-hud .btn-add-green {
  height: 19px;
  min-width: 54px;
  margin-left: auto;
  padding: 0 8px;
  background: linear-gradient(180deg, #67c6a3 0%, #318b6a 55%, #20684e 100%);
  border: 1px solid #ace6d1;
  border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 0 0 1px #0c2d21, 0 1px 3px rgba(0, 0, 0, 0.8);
  color: #fff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-shadow: 0 1px 1px #0c3325;
  cursor: pointer;
}
#main-top-hud .btn-add-green:hover { filter: brightness(1.12); }

/* ---------- Fiche du joueur (bloc gauche à bord diagonal doré) ---------- */
#main-top-hud .hud-profile {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  width: 215px;
  height: 101px;
  /* couche extérieure dorée = liseré de la diagonale et du bas */
  background: linear-gradient(180deg, var(--hud-gold-hi), var(--hud-gold));
  clip-path: polygon(0 0, 215px 0, 215px 27px, 161px 101px, 0 101px);
}
#main-top-hud .hud-profile::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    var(--hud-deco) 0 0 / 24px 24px,
    linear-gradient(90deg, #0b0b0b 0%, #1c1c1c 45%, #0a0a0a 100%);
  border-top: 3px solid #2c715a;
  /* déborde à droite du clip parent pour ne laisser aucun liseré sur le bandeau */
  clip-path: polygon(0 0, 230px 0, 230px 25px, 214px 25px, 159.6px 99px, 0 99px);
}

#main-top-hud .hud-portrait {
  position: absolute;
  top: 3px;
  left: 4px;
  width: 66px;
  height: 96px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, #000 70%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 70%, transparent 100%);
}
#main-top-hud .hud-portrait img {
  /* portraits en pied, tous de 520 px de haut mais de largeurs différentes : même hauteur pour tous, centrés, tête et épaules visibles */
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  height: 340px;
  width: auto;
  max-width: none;
}

#main-top-hud .hud-prof-row {
  position: absolute;
  left: 68px;
  display: flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  white-space: nowrap;
}
/* filets de séparation qui s'estompent vers la droite */
#main-top-hud .hud-prof-row::after {
  content: '';
  position: absolute;
  left: 4px;
  bottom: 0;
  width: 120px;
  height: 1px;
  background: linear-gradient(90deg, rgba(177, 143, 98, 0.35), transparent);
}
#main-top-hud .hud-prof-name { top: 3px; left: 76px; height: 27px; }
/* Nom du joueur, et son rang dans la Famille sur une petite ligne juste dessous */
#main-top-hud .hud-name-stack { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
#main-top-hud .hud-name-stack .hud-player-name { line-height: 15px; }
#main-top-hud .hud-prof-respect { top: 31px; left: 64px; }
#main-top-hud .hud-prof-influence { top: 56px; left: 66px; }
#main-top-hud .hud-prof-influence::after { display: none; }

#main-top-hud .hud-family-crest {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  padding: 1px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  border: 1px solid #d9d9d9;
  background: #151515;
  box-shadow: 0 1px 2px #000;
}
#main-top-hud .hud-family-crest img { width: 100%; height: 100%; object-fit: contain; filter: grayscale(1) brightness(1.6); }

#main-top-hud .hud-player-name {
  max-width: 112px; /* toute la ligne, jusqu'au bord de la fiche : le rang est passé dessous */
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  font-weight: 400;
  color: #e8e8e8;
  text-shadow: 0 1px 1px #000;
}
#main-top-hud .hud-player-rank {
  line-height: 11px;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--gold-primary);
}

#main-top-hud .hud-prof-icon {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  filter: drop-shadow(0 1px 1px #000);
}
#main-top-hud .hud-prof-gun { width: 28px; height: 28px; margin: -3px 0; object-fit: contain; }

#main-top-hud .hud-respect-value {
  font-size: 12px;
  font-weight: 700;
  color: #c7985b;
  text-shadow: 0 1px 1px #000;
}
#main-top-hud .hud-influence-value {
  font-size: 12px;
  color: #e8e8e8;
  text-shadow: 0 1px 1px #000;
}

/* barre rouge de niveau à bout biseauté, pastille ronde à cheval sur sa gauche */
#main-top-hud .hud-level-bar {
  position: absolute;
  top: 82px;
  left: 50px;
  width: 102px;
  height: 14px;
}
#main-top-hud .hud-level-bar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #ca4233 0%, #9c3024 50%, #6c1f16 100%);
  clip-path: polygon(0 0, 100% 0, 92% 100%, 0 100%);
}
#main-top-hud .badge-level-crest {
  position: absolute;
  top: -5px;
  left: -10px;
  z-index: 1;
  width: 24px;
  height: 24px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #2a2a2a, var(--ink-black) 75%);
  border: 1px solid #9a9a9a;
  box-shadow: 0 0 0 1px #000, 0 1px 3px rgba(0, 0, 0, 0.9);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

/* ---------- Rangée de navigation (plan de la ville) ---------- */
#main-top-hud .hud-navbar {
  display: none;
  position: absolute;
  top: var(--hud-bar-h);
  left: 160px;
  right: 168px;
  height: 26px;
  z-index: 1;
  align-items: flex-end;
  padding: 0 0 5px 46px;
  box-sizing: border-box;
  background: linear-gradient(180deg, var(--hud-gold-hi), var(--hud-gold));
  clip-path: polygon(20px 0, 100% 0, 100% 100%, 0 100%);
}
#main-top-hud .hud-navbar::before {
  content: '';
  position: absolute;
  inset: 0 0 2px 2px;
  background: var(--hud-deco) 0 0 / 24px 24px, linear-gradient(180deg, #121212 0%, var(--ink-black) 100%);
  clip-path: polygon(19px 0, 100% 0, 100% 100%, 0 100%);
}
#game-container.view-city #main-top-hud .hud-navbar { display: flex; }

#main-top-hud .city-nav-coords-bar {
  position: relative;
  top: auto;
  left: auto;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  height: 18px;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
}

#main-top-hud .coord-input {
  width: 58px;
  height: 16px;
  padding: 0 3px;
  background: #fff;
  color: #111;
  border: 1px solid #777;
  border-radius: 1px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
  font-family: inherit;
  font-size: 11px;
}
#main-top-hud .coord-input:focus { outline: none; border-color: var(--hud-gold-hi); }
#main-top-hud .coord-sep { color: #ddd; font-weight: 700; }

#main-top-hud .nav-bookmarks {
  display: flex;
  align-items: stretch;
  height: 17px;
  margin-left: 6px;
}
#main-top-hud .nav-bookmarks-label {
  display: flex;
  align-items: center;
  width: 160px;
  padding: 0 6px;
  background: #0a0a0a;
  border: 1px solid var(--hud-gold);
  border-right: none;
  color: #d1a46a;
  font-size: 11px;
  font-weight: 700;
}
#main-top-hud .nav-chevron {
  width: 19px;
  padding: 0;
  background: linear-gradient(180deg, #cc5245 0%, #7a271e 100%);
  border: 1px solid var(--hud-gold-hi);
  border-radius: 0;
  cursor: pointer;
}
#main-top-hud .nav-chevron svg { width: 11px; height: 11px; }

#main-top-hud .nav-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 18px;
  min-width: 20px;
  padding: 0 2px;
  background: none;
  border: 1px solid transparent;
  border-radius: 2px;
  color: #d1a46a;
  font-family: inherit;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
}
#main-top-hud .nav-icon-btn svg { width: 17px; height: 17px; filter: drop-shadow(0 1px 1px #000); }
#main-top-hud .nav-icon-btn.nav-go {
  width: 22px;
  background: linear-gradient(180deg, #b04236 0%, #5e1d16 100%);
  border-color: var(--hud-gold-hi);
}
#main-top-hud .nav-icon-btn:hover:not(:disabled) { filter: brightness(1.25); }
#main-top-hud .nav-icon-btn.active { border-color: #d1a46a; background: rgba(209, 164, 106, 0.18); }
#main-top-hud .nav-icon-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Boosts (ressources, défense, attaque) : trois pastilles en haut à gauche, un point vert quand le boost est actif */
#main-top-hud .hud-boosts { gap: 2px; top: 7px; } /* au-dessus du nom du quartier, sans le toucher */
.hud-boost-btn { position: relative; width: 16px; height: 16px; padding: 2px; display: flex; align-items: center; justify-content: center; cursor: pointer; background: linear-gradient(180deg, #3a3a3a 0%, #161616 100%); border: 1px solid #6e5d46; border-radius: 3px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.85); }
.hud-boost-btn svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.8)); }
.hud-boost-btn:hover { border-color: var(--gold-sand); filter: brightness(1.15); }
.hud-boost-btn.is-active { border-color: #5ee4b3; box-shadow: 0 0 6px rgba(94, 228, 179, 0.7), 0 1px 3px #000; }
.boost-dot { display: none; position: absolute; right: -2px; bottom: -2px; width: 5px; height: 5px; border-radius: 50%; background: #5ee4b3; border: 1px solid #073323; }
.hud-boost-btn.is-active .boost-dot { display: block; }
