/* ============================================================================
   BIRODALMAK — HUD-VIZUÁL  (TULAJDONOS: „HUD-vizuál" agent)
   ----------------------------------------------------------------------------
   Ez a lap a `style.css` UTÁN tölt be, és CSAK a HUD-réteget öltözteti át:
   felső sáv · erőforrás-kijelzők · kutatás-chip · város-fülek · értesítés-oszlop
   · egység/város-panel · mobil parancssáv · minitérkép · tooltipek.

   Alapelv: EGY keret-, árnyék- és sugár-rendszer (arany-obszidián), tabuláris
   számok, 44 px-es érintőcélok, és semmi harsány szín — a figyelmet a
   tartalom-ikonok és a finom arany élek viszik.

   Tartalom:
     0. Design-tokenek            6. Értesítés-oszlop
     1. Közös panel-rendszer      7. Egység / város panel
     2. Felső sáv                 8. Mobil parancssáv + kör vége
     3. Erőforrás-kijelzők        9. Minitérkép
     4. Kutatás-chip             10. Tooltip / bontás-popover
     5. Város-fülek              11. Reszponzív + a11y
   ========================================================================== */

/* ============================ 0. DESIGN-TOKENEK =========================== */
:root {
  /* keret-rendszer: minden HUD-panel ezt használja */
  --hud-r:        12px;   /* nagy panel */
  --hud-r-m:      9px;    /* chip, gomb */
  --hud-r-s:      6px;    /* apró elem */
  --hud-bg:       linear-gradient(180deg, rgba(23, 31, 42, .93), rgba(11, 16, 23, .96));
  --hud-bg-2:     linear-gradient(180deg, rgba(31, 41, 54, .95), rgba(15, 21, 30, .97));
  --hud-edge:     rgba(217, 180, 95, .30);
  --hud-edge-hi:  rgba(240, 210, 144, .55);
  --hud-edge-soft: rgba(255, 255, 255, .08);
  --hud-shadow:   0 12px 30px rgba(0, 0, 0, .52);
  --hud-inset:    inset 0 1px 0 rgba(255, 255, 255, .07);
  --hud-hover:    rgba(217, 180, 95, .16);
  --hud-active:   rgba(217, 180, 95, .26);
  --hud-ink:      #05080d;
  /* számok: tabuláris, hogy ne ugráljon a szélesség */
  --hud-num: "Inter", system-ui, sans-serif;
}

/* Emoji-fallback (ha nincs ikon-modul): egységes optikai méret + finom árnyék */
.hud-emo {
  display: inline-block; line-height: 1; font-style: normal;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .55));
}
/* Az ikon-modul (`ui/icon.js`) `.bi-ico` spanjai: a méretet a JS adja (px),
   itt csak a függőleges igazítást hangoljuk a HUD sűrű soraihoz. */
.res .ri .bi-ico, .tb-ic .bi-ico, .notif .nf-ic .bi-ico,
.ct-ic .bi-ico, .ct-pi .bi-ico, .act-btn .ai .bi-ico, .mob-act .ai .bi-ico,
.sp-icon .bi-ico, .mu-ic .bi-ico { vertical-align: 0; }
.sp-stat .bi-ico, .res-pop .rb-head .bi-ico { vertical-align: -0.14em; }

/* ========================= 1. KÖZÖS PANEL-RENDSZER ======================== */
/* Ugyanaz a háttér + él + árnyék MINDEN lebegő HUD-felületen. */
#minimapBox, #cityBar, #selPanel, #tileInfo, #hudTip, .notif, #btnIdle {
  background: var(--hud-bg);
  border: 1px solid var(--hud-edge-soft);
  box-shadow: var(--hud-shadow), var(--hud-inset);
  backdrop-filter: blur(9px);
}
#minimapBox, #selPanel { border-color: var(--hud-edge); }
#cityBar, #selPanel, #minimapBox { border-radius: var(--hud-r); }
#tileInfo, #hudTip { border-radius: var(--hud-r-m); }

/* Arany hajszál-fény a panelek tetején (közös „fém-perem" motívum) */
#selPanel::before, #minimapBox::before, #cityBar::before {
  content: ''; position: absolute; left: 12px; right: 12px; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--hud-edge-hi), transparent);
  pointer-events: none;
}
#selPanel, #minimapBox, #cityBar { position: fixed; }

/* ============================== 2. FELSŐ SÁV ============================= */
#topbar {
  gap: 12px;
  background:
    linear-gradient(180deg, rgba(9, 13, 19, .98), rgba(9, 13, 19, .88)),
    radial-gradient(900px 60px at 50% 0%, rgba(217, 180, 95, .10), transparent 70%);
  border-bottom: 1px solid var(--hud-edge);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .38);
}

/* --- birodalom-zászló --- */
.tb-civ { gap: 10px; }
.tb-banner {
  background: linear-gradient(150deg, #33405333, #10161f), var(--hud-bg-2);
  border-color: var(--hud-edge);
  box-shadow: var(--hud-inset), 0 2px 8px rgba(0, 0, 0, .45);
}
.tb-civ-name { font-size: 13.5px; color: #f6efdf; }
.tb-civ-leader { font-size: 10.5px; letter-spacing: .2px; }

/* --- gomb-csoportok: értelmes blokkok, finom elválasztókkal --- */
.tb-btns { gap: 0; align-items: center; }
.tb-group {
  display: flex; align-items: center; gap: 3px;
  padding: 3px; border-radius: 11px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(255, 255, 255, .05);
}
.tb-group + .tb-group { margin-left: 9px; position: relative; }
.tb-group + .tb-group::before {          /* elválasztó pálca a csoportok között */
  content: ''; position: absolute; left: -5px; top: 15%; bottom: 15%; width: 1px;
  background: linear-gradient(180deg, transparent, rgba(217, 180, 95, .38), transparent);
}
.tb-btn {
  width: 34px; height: 34px; border-radius: var(--hud-r-m); font-size: 16px;
  background: transparent; border: 1px solid transparent;
  transition: background .14s, border-color .14s, transform .14s;
}
.tb-btn .tb-ic { display: grid; place-items: center; font-size: 16px; line-height: 1; }
.tb-btn:hover { background: var(--hud-hover); border-color: var(--hud-edge); transform: translateY(-1px); }
.tb-btn:active { transform: none; background: var(--hud-active); }

/* állapot-jelzők: pötty (figyelem) / felkiáltójel (döntést vár) */
.tb-badge {
  position: absolute; top: -3px; right: -3px; pointer-events: none;
  box-shadow: 0 0 0 2px rgba(9, 13, 19, .95);
}
.tb-badge.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff9c9c, var(--bad));
  animation: tbDot 1.9s ease-in-out infinite;
}
.tb-badge.alert {
  min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px;
  display: grid; place-items: center; font-size: 10px; font-weight: 800; line-height: 1;
  color: #2a1e02; background: linear-gradient(160deg, #f4dd93, var(--warn));
}
@keyframes tbDot { 0%, 100% { box-shadow: 0 0 0 2px rgba(9, 13, 19, .95); } 50% { box-shadow: 0 0 0 2px rgba(9, 13, 19, .95), 0 0 9px 2px rgba(226, 106, 106, .55); } }

/* --- kör / évszám --- */
.tb-turn {
  margin-left: 10px; padding: 4px 10px; border-radius: var(--hud-r-m);
  background: rgba(255, 255, 255, .04); border: 1px solid var(--hud-edge-soft);
}
.tb-turn b { font-size: 12.5px; color: var(--gold-2); letter-spacing: .4px; font-variant-numeric: tabular-nums; }
.tb-turn i { font-size: 10px; letter-spacing: .2px; }

/* ======================== 3. ERŐFORRÁS-KIJELZŐK ========================== */
.tb-res {
  gap: 4px; padding: 3px; border-radius: 11px;
  background: rgba(255, 255, 255, .035); border: 1px solid rgba(255, 255, 255, .05);
}
.res {
  position: relative; align-items: center; gap: 6px;
  padding: 4px 9px 4px 7px; min-height: 30px; border-radius: 8px;
  background: transparent; border: 1px solid transparent;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
  cursor: help; transition: background .14s, border-color .14s;
}
.res:hover { background: rgba(255, 255, 255, .06); border-color: var(--hud-edge-soft); }
.res .ri { display: grid; place-items: center; width: 16px; height: 16px; font-size: 14px; opacity: .95; }
.res b { font-size: 13.5px; font-weight: 700; letter-spacing: .2px; line-height: 1; }
.res i {
  font-size: 10.5px; line-height: 1; font-weight: 600; letter-spacing: .1px;
  color: var(--text-dim); font-variant-numeric: tabular-nums;
}
.res i.pos { color: var(--good); }
.res i.neg { color: var(--bad); }
.res i.unit { color: var(--text-dim); font-weight: 500; opacity: .8; }
/* színkód: a szám viszi a kategória színét, az ikon semleges marad */
#resGold b  { color: var(--gold-2); }
#resSci b   { color: var(--sci); }
#resCult b  { color: var(--cult); }
#resFaith b { color: var(--faith); }

/* =========================== 4. KUTATÁS-CHIP ============================= */
.research-chip {
  min-width: 208px; padding: 5px 12px 7px; border-radius: var(--hud-r-m);
  background: linear-gradient(180deg, rgba(95, 199, 232, .13), rgba(95, 199, 232, .05));
  border: 1px solid rgba(95, 199, 232, .30);
  box-shadow: var(--hud-inset);
}
.research-chip:hover { background: linear-gradient(180deg, rgba(95, 199, 232, .22), rgba(95, 199, 232, .08)); }
.rc-icon { font-size: 15px; opacity: .95; }
.rc-text b { font-size: 12.5px; letter-spacing: .1px; }
.rc-text i { font-size: 10.5px; font-variant-numeric: tabular-nums; }
.rc-bar { height: 3px; background: rgba(0, 0, 0, .35); }
.rc-bar > span { background: linear-gradient(90deg, var(--sci), #b6ecff); box-shadow: 0 0 8px rgba(95, 199, 232, .6); }
.research-chip.empty { border-color: rgba(232, 193, 74, .6); background: linear-gradient(180deg, rgba(232, 193, 74, .18), rgba(232, 193, 74, .06)); }

/* ============================ 5. VÁROS-FÜLEK ============================= */
#cityBar { padding: 4px; }
.cb-scroll { gap: 4px; }
.city-tab {
  position: relative; overflow: hidden;
  gap: 8px; padding: 4px 8px 6px; min-height: 38px; border-radius: 9px;
  background: rgba(255, 255, 255, .035); border: 1px solid rgba(255, 255, 255, .07);
}
.city-tab:hover { background: var(--hud-hover); border-color: var(--hud-edge); }
.city-tab.cap { border-color: rgba(217, 180, 95, .40); background: rgba(217, 180, 95, .07); }

/* ikon + lakosszám-jelvény */
.city-tab .ct-ic { position: relative; display: grid; place-items: center; width: 20px; height: 20px; font-size: 15px; }
.city-tab .ct-pop {
  position: absolute; right: -6px; bottom: -5px; min-width: 14px; height: 14px; padding: 0 3px;
  border-radius: 7px; font-size: 9.5px; font-weight: 700; line-height: 14px; text-align: center;
  color: #f6efdf; background: rgba(10, 14, 20, .92); border: 1px solid var(--hud-edge-soft);
  font-variant-numeric: tabular-nums;
}
.city-tab .ct-txt { gap: 1px; max-width: 132px; }
.city-tab .ct-txt b { font-size: 11.5px; letter-spacing: .3px; color: #f6efdf; overflow: hidden; text-overflow: ellipsis; }
.city-tab .ct-txt i {
  display: flex; align-items: center; gap: 4px; font-size: 10px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.city-tab .ct-pi { display: inline-grid; place-items: center; width: 12px; height: 12px; font-size: 11px; }

/* hátralévő kör */
.city-tab .ct-turns {
  display: flex; flex-direction: column; align-items: center; line-height: 1;
  padding: 3px 6px; border-radius: 7px; background: rgba(217, 180, 95, .12);
  color: var(--gold-2); font-variant-numeric: tabular-nums;
}
.city-tab .ct-turns b { font-size: 11.5px; font-family: var(--hud-num); }
.city-tab .ct-turns small { font-size: 8px; opacity: .7; letter-spacing: .2px; }

/* „nem termel" — feltűnő, de nem harsány: borostyán él + halk pulzáló pötty */
.city-tab.idle { border-color: rgba(232, 193, 74, .45); background: rgba(232, 193, 74, .07); }
.city-tab .ct-warn { color: var(--warn); font-weight: 600; }
.city-tab .ct-warn::before {
  content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%;
  background: var(--warn); animation: idleDot 2.2s ease-in-out infinite; vertical-align: middle;
}
.city-tab .ct-turns.alert { background: rgba(232, 193, 74, .18); color: var(--warn); font-weight: 800; padding: 4px 8px; }
@keyframes idleDot { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

/* termelés-előrehaladás: hajszálvékony csík a fül alján */
.city-tab .ct-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(0, 0, 0, .35); }
.city-tab .ct-bar > i { display: block; height: 100%; background: linear-gradient(90deg, #e0a04a, #f2c98a); }
.city-tab.idle .ct-bar > i { background: rgba(232, 193, 74, .35); }

/* ========================= 6. ÉRTESÍTÉS-OSZLOP =========================== */
/* Asztalon KÁRTYA (ikon + cím + részlet + darabszám), mobilon ikon-pirula. */
#notifCol { gap: 6px; }
.notif {
  display: flex; align-items: center; gap: 9px;
  width: 262px; max-width: 268px; min-height: 46px; padding: 6px 10px 6px 6px;
  border-radius: 11px; overflow: hidden; text-align: left;
  border-left: 3px solid var(--hud-edge-soft);
  transition: transform .14s, border-color .14s, background .14s;
}
.notif:hover, .notif:focus-visible { max-width: 268px; transform: translateX(-3px); background: var(--hud-bg-2); }
.notif .nf-ic {
  flex: 0 0 auto; width: 32px; height: 32px; font-size: 17px; border-radius: 9px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .07);
}
.notif .nf-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; opacity: 1; }
.notif .nf-title {
  font-family: Cinzel, Georgia, serif; font-size: 11px; letter-spacing: .5px;
  text-transform: uppercase; color: var(--gold-2); line-height: 1.1;
}
.notif .nf-txt {
  opacity: 1; font-size: 11.5px; color: var(--text); line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 186px; padding: 0;
}
.notif .nf-go { margin-left: auto; color: var(--text-dim); font-size: 15px; opacity: .5; }
.notif:hover .nf-go { opacity: 1; color: var(--gold-2); }
.notif .nf-count {
  top: -5px; right: -5px; min-width: 18px; height: 18px; border-radius: 9px;
  font-size: 10.5px; box-shadow: 0 0 0 2px rgba(11, 16, 23, .96);
}
/* kategória-színek: bal él + ikon-háttér */
.notif.sci   { border-left-color: var(--sci); }
.notif.sci   .nf-ic { background: rgba(95, 199, 232, .16); }
.notif.warn  { border-left-color: var(--warn); }
.notif.warn  .nf-ic { background: rgba(232, 193, 74, .16); }
.notif.bad   { border-left-color: #ef8f5a; }
.notif.bad   .nf-ic { background: rgba(239, 143, 90, .16); }
.notif.unit  { border-left-color: var(--good); }
.notif.unit  .nf-ic { background: rgba(111, 209, 138, .16); }
.notif.war   { border-left-color: var(--bad); }
.notif.war   .nf-ic { background: rgba(226, 106, 106, .18); }
.notif.war   .nf-title { color: #f0a0a0; }

/* ======================= 7. EGYSÉG / VÁROS PANEL ========================= */
#selPanel { width: 328px; overflow: visible; }
#selPanel::after {                     /* birodalom-színű alsó él */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--civ, var(--gold)), transparent);
  opacity: .55; border-radius: 0 0 var(--hud-r) var(--hud-r);
}
.sp-head {
  gap: 12px; padding: 12px 12px 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, 0));
  border-bottom: 1px solid rgba(255, 255, 255, .05);
}

/* portré: arany keret + birodalom-színű belső fény */
.sp-portrait {
  width: 68px; height: 68px; border-radius: 12px;
  background: radial-gradient(circle at 38% 26%, #35435a, #0f151e 74%);
  border: 1px solid var(--hud-edge);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .5), inset 0 0 18px -4px var(--civ, #d9b45f), 0 4px 14px rgba(0, 0, 0, .45);
}
#spPortrait { width: 68px; height: 68px; }
.sp-icon {
  right: -2px; bottom: -2px; width: 24px; height: 24px; font-size: 12px;
  border-radius: 9px 0 11px 0; background: rgba(6, 10, 15, .92);
  border-top: 1px solid var(--hud-edge); border-left: 1px solid var(--hud-edge);
}
.sp-title b { font-size: 15.5px; letter-spacing: .3px; color: #f8f1e2; }
.sp-title i { font-size: 11px; }
.sp-promo { margin-top: 4px; gap: 6px; }
.sp-promo .stars { display: inline-flex; gap: 1px; font-size: 12px; }
.sp-promo .star { text-shadow: 0 0 8px rgba(240, 210, 144, .55); }
.sp-promo .xp { margin-left: 0; font-size: 9.5px; letter-spacing: .2px; }
.sp-close { width: 30px; height: 30px; border-radius: 8px; }

/* sávok: magasabb, tagoltabb, tabuláris értékkel */
.sp-bars { padding: 2px 12px 10px; gap: 6px; }
.sp-bar { font-size: 10.5px; gap: 8px; }
.sp-bar .sb-lb { width: 16px; font-size: 12px; text-align: center; }
.sp-bar .sb-track {
  height: 10px; border-radius: 6px; background: rgba(0, 0, 0, .38);
  border: 1px solid rgba(255, 255, 255, .07); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .5);
  position: relative;
}
.sp-bar .sb-track::after {             /* negyedelő osztás — könnyebb becsülni */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 24.6%, rgba(0, 0, 0, .38) 24.6% 25%);
}
.sp-bar .sb-fill { box-shadow: 0 0 10px -2px currentColor; }
.sp-bar .sb-val { width: 52px; font-size: 10.5px; color: var(--text); opacity: .85; }

/* egység-váltó pirulák */
.sp-switch { padding: 0 12px 9px; gap: 5px; }
.usw { border-radius: 9px; background: rgba(255, 255, 255, .045); }
.usw.on { box-shadow: 0 0 0 1px rgba(217, 180, 95, .35); }

/* stat-chipek */
.sp-stats { gap: 5px; padding: 9px 12px; border-top: 1px solid rgba(255, 255, 255, .05); }
.sp-stat {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; padding: 3px 8px; border-radius: 7px;
  background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .07);
}
.sp-stat.good { color: #a6e6bb; border-color: rgba(111, 209, 138, .28); background: rgba(111, 209, 138, .10); }
.sp-stat.bad  { color: #f0a0a0; border-color: rgba(226, 106, 106, .30); background: rgba(226, 106, 106, .10); }
.sp-stat.on   { color: var(--gold-2); border-color: rgba(217, 180, 95, .34); background: rgba(217, 180, 95, .12); }
.sp-stat.off  { opacity: .6; }

/* parancs-gombok: ikon + felirat + billentyű; az elsődleges teljes szélességű */
.sp-actions { gap: 6px; padding: 10px 12px 12px; }
.act-btn {
  gap: 8px; padding: 8px 10px; min-height: 38px; border-radius: 9px;
  background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .08);
  font-size: 12px;
}
.act-btn .ai { display: grid; place-items: center; width: 18px; height: 18px; font-size: 15px; }
.act-btn:hover:not(:disabled) { background: var(--hud-hover); border-color: var(--hud-edge); }
.act-btn.primary {
  grid-column: 1 / -1;
  background: linear-gradient(160deg, rgba(217, 180, 95, .95), rgba(168, 130, 47, .95));
  border-color: var(--gold-2); color: #241a04; font-weight: 700;
  box-shadow: 0 6px 18px rgba(217, 180, 95, .28);
}
.act-btn.primary .ak { color: #3b2c07; background: rgba(255, 255, 255, .35); border-color: rgba(0, 0, 0, .2); }
.act-btn.primary:hover:not(:disabled) { background: linear-gradient(160deg, #f0d290, #c49a3c); border-color: #fff0c8; }
.act-btn.danger { border-color: rgba(226, 106, 106, .28); }
.sp-hint { display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 10px; opacity: .75; padding-top: 4px; }
.sp-hint kbd {
  font-family: ui-monospace, monospace; font-size: 9.5px; padding: 1px 5px; border-radius: 4px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); color: var(--gold-2);
}

/* ==================== 8. MOBIL PARANCSSÁV + KÖR VÉGE ===================== */
#mobBar {
  background: linear-gradient(0deg, rgba(7, 11, 16, .99), rgba(9, 14, 20, .93));
  border-top: 1px solid var(--hud-edge);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, .45);
}
.mob-unit .mu-ic { display: grid; place-items: center; width: 20px; height: 20px; font-size: 17px; }
.mob-unit .mu-sub { color: var(--text-dim); font-size: 11px; font-variant-numeric: tabular-nums; }
.mob-unit .mu-bar { height: 7px; border-radius: 4px; background: rgba(0, 0, 0, .4); }
.mob-act {
  border-radius: 11px; background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .09); gap: 3px;
}
.mob-act .ai { display: grid; place-items: center; width: 22px; height: 22px; font-size: 19px; }
.mob-act.primary {
  background: linear-gradient(160deg, rgba(217, 180, 95, .95), rgba(168, 130, 47, .95));
  border-color: var(--gold-2); color: #241a04; font-weight: 700;
}
#btnIdle { border-radius: var(--hud-r-m); }
#btnEnd { box-shadow: 0 8px 26px rgba(217, 180, 95, .30), var(--hud-inset); }

/* ============================= 9. MINITÉRKÉP ============================= */
#minimapBox { padding: 7px; }
.mm-head { padding: 0 2px 6px; gap: 3px; }
.mm-title {
  font-family: Cinzel, Georgia, serif; font-size: 9.5px; letter-spacing: 1.2px;
  color: var(--gold-2); opacity: .85;
}
.mm-ic { border-radius: 6px; }
.mm-ic:hover { background: var(--hud-hover); }
/* a vászon kap egy „bekeretezett pergamen" hatást */
#minimap {
  border-radius: 6px;
  background: #3a3223;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, .55),
    0 0 0 2px rgba(217, 180, 95, .30),
    inset 0 0 24px rgba(0, 0, 0, .45);
}
.mm-tools { gap: 4px; margin-top: 8px; }
.mm-tools button {
  border-radius: 7px; background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .07); color: var(--text-dim); transition: .14s;
}
.mm-tools button:hover { background: var(--hud-hover); color: var(--text); }
/* A „3D" felirat betű, nem emodzsi — kicsit kisebb és sűrűbb, hogy kiférjen. */
.mm-tools #btn3D { font-size: 11px; font-weight: 800; letter-spacing: .02em; }
.mm-tools button.on {
  background: rgba(217, 180, 95, .26); border-color: var(--hud-edge); color: var(--gold-2);
  box-shadow: inset 0 0 10px -3px rgba(240, 210, 144, .8);
}

/* ==================== 10. TOOLTIP / BONTÁS-POPOVER ======================= */
#hudTip {
  position: fixed; z-index: 55; pointer-events: none;
  display: flex; align-items: center; gap: 7px;
  padding: 6px 9px; font-size: 11.5px; line-height: 1.35; max-width: 260px;
  color: var(--text); animation: htIn .12s ease-out;
}
@keyframes htIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
#hudTip .ht-t { white-space: normal; }
#hudTip .ht-k {
  font-family: ui-monospace, monospace; font-size: 10px; padding: 1px 5px; border-radius: 4px;
  color: var(--gold-2); background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .16);
}
/* erőforrás-bontás */
#hudTip .res-pop { display: block; min-width: 186px; }
.res-pop .rb-head {
  display: flex; align-items: center; gap: 6px; padding-bottom: 5px; margin-bottom: 5px;
  border-bottom: 1px solid rgba(255, 255, 255, .10); font-size: 12px;
}
.res-pop .rb-head b { font-family: Cinzel, Georgia, serif; letter-spacing: .4px; color: var(--gold-2); }
.res-pop .rb-stock { margin-left: auto; font-size: 10px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.res-pop .rb-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  font-size: 11px; color: var(--text-dim); padding: 1.5px 0;
}
.res-pop .rb-row b { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }
.res-pop .rb-row b.pos { color: var(--good); }
.res-pop .rb-row b.neg { color: var(--bad); }
.res-pop .rb-row.total {
  margin-top: 5px; padding-top: 5px; border-top: 1px solid rgba(255, 255, 255, .10);
  font-size: 11.5px; color: var(--text);
}

/* mező-tooltip: ugyanaz a keret-nyelv */
#tileInfo { padding: 8px 10px; max-width: 262px; }
#tileInfo .ti-name { letter-spacing: .3px; }

/* átfutó toastok: kicsit lágyabb, egységes sugár */
.toast { border-radius: 9px; border-left-width: 3px; box-shadow: var(--hud-shadow); }

/* ======================== 11. RESZPONZÍV + A11Y ========================== */

/* --- szűkebb asztali sáv: kisebb gombok, hogy ne törjön a felső sáv --- */
@media (max-width: 1280px) {
  .tb-btn { width: 31px; height: 31px; font-size: 15px; }
  .tb-group + .tb-group { margin-left: 7px; }
  .research-chip { min-width: 176px; }
  #selPanel { width: 312px; }
}

/* --- tablet és kisebb --- */
@media (max-width: 900px) {
  .tb-res { padding: 2px; gap: 2px; }
  .res { padding: 3px 7px 3px 6px; gap: 4px; min-height: 28px; }
  .res b { font-size: 12.5px; }
  .res i { font-size: 9.5px; }
  .tb-turn { padding: 3px 7px; margin-left: 4px; }

  /* a lenyíló gombsor: csoportok egymás alatt, csoport-fejléc nélkül */
  .tb-btns { flex-direction: column; align-items: stretch; gap: 6px; padding: 8px; border-radius: 0 0 14px 14px; }
  .tb-group { gap: 6px; padding: 0; background: none; border: none; justify-content: flex-end; }
  .tb-group + .tb-group { margin-left: 0; padding-top: 6px; border-top: 1px solid rgba(217, 180, 95, .22); }
  .tb-group + .tb-group::before { display: none; }
  .tb-btn { width: var(--tap); height: var(--tap); font-size: 20px; background: rgba(255, 255, 255, .05); border-color: var(--hud-edge-soft); }
  .tb-btn .tb-ic { font-size: 20px; }
  .tb-more { border-radius: var(--hud-r-m); }

  #cityBar { padding: 4px; }
  .city-tab { min-height: 42px; }
  .city-tab .ct-txt { max-width: 118px; }

  #minimapBox { padding: 6px; }
}

/* --- telefon --- */
@media (max-width: 700px) {
  /* értesítések: ikon-pirula, koppintásra kinyíló kártya */
  .notif { width: auto; max-width: var(--tap); min-height: var(--tap); padding: 0; border-left-width: 3px; }
  .notif .nf-ic { width: 40px; height: 40px; margin-left: 2px; font-size: 19px; }
  .notif .nf-body, .notif .nf-go { display: none; }
  .notif:hover, .notif:focus-visible, .notif:active {
    max-width: min(78vw, 290px); padding: 0 10px 0 0; transform: none;
  }
  .notif:hover .nf-body, .notif:focus-visible .nf-body, .notif:active .nf-body { display: flex; }
  .notif .nf-txt { max-width: 168px; }

  /* mobil parancssáv: nagyobb célok */
  .mob-act { min-width: 56px; min-height: var(--tap); font-size: 9.5px; }
  #hudTip { display: none; }              /* érintésen nincs hover → felesleges */
}

/* --- telefon-elrendezés finomhangolás --- */
@media (max-width: 700px) {
  /* a toastok ne lógjanak rá a minitérképre (az max(172px) széles + keret) */
  #toasts { width: min(48vw, 186px); }
  .toast { font-size: 11.5px; padding: 7px 9px; }
  /* a város-fülek ne bújjanak a KÖR VÉGE gomb alá */
  #cityBar { right: calc(env(safe-area-inset-right) + 146px); }
  /* kutatás-chip: mindig ellipszissel csonkoljon, sose vágja félbe a szót */
  .research-chip { overflow: hidden; }
  .rc-text { min-width: 0; overflow: hidden; }
  .rc-text b { max-width: 100%; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* --- nagyon keskeny telefon (≤430 px): a hit fér ki utoljára --- */
@media (max-width: 430px) {
  #resFaith { display: none; }
  #resSci { display: flex; }              /* a tudomány FONTOS — visszahozzuk */
  #resCult { display: none; }
  .res { padding: 3px 5px; gap: 3px; }
  .res .ri { width: 14px; height: 14px; font-size: 13px; }
  .res b { font-size: 12px; }
  .res i { display: none; }               /* a kör-változás a bontásban látszik */
  #topbar { gap: 6px; }
  .research-chip { flex: 1 1 auto; min-width: 86px; max-width: 132px; padding: 4px 8px 6px; }
  .rc-icon { display: none; }             /* a hely a technológia NEVÉÉ */
  .rc-text b { font-size: 11px; }
  .tb-turn { min-width: 0; padding: 3px 6px; margin-left: 2px; }
  .tb-turn b { font-size: 11px; }
  .city-tab .ct-txt { max-width: 104px; }
}

/* --- érintőcélok: minden interaktív HUD-elem ≥44 px --- */
@media (pointer: coarse), (max-width: 900px) {
  /* a kutatás-csempe is KATTINTHATÓ (megnyitja a tech-fát) — mérve 121×26 px volt,
     ezért az érintőcél-szabály alá esett */
  .tb-btn, .tb-more, .mm-ic, .sp-close, .notif, .city-tab, .act-btn, .mm-tools button,
  .research-chip {
    min-height: var(--tap);
  }
  .research-chip { display: flex; align-items: center; }
  .act-btn { padding: 10px 12px; font-size: 13px; }
  .sp-close { width: var(--tap); height: var(--tap); }
}

/* --- mozgás-csökkentés --- */
@media (prefers-reduced-motion: reduce) {
  .tb-badge.dot, .city-tab .ct-warn::before { animation: none !important; }
  .notif:hover, .act-btn:hover, .tb-btn:hover { transform: none !important; }
}

/* --- erős kontraszt --- */
@media (prefers-contrast: more) {
  :root {
    --hud-bg: linear-gradient(180deg, rgba(10, 14, 20, .99), rgba(6, 10, 15, .99));
    --hud-edge: rgba(240, 210, 144, .6);
    --hud-edge-soft: rgba(255, 255, 255, .26);
  }
  .notif .nf-txt, .city-tab .ct-txt i, .res i { color: #e6e0d2; }
}

/* ==================== 12. 3D VÁROSNÉV-CÍMKÉK (labels3d.js) ================= */
/* A 3D vászon FÖLÖTT lebegő DOM-réteg: a `renderer.drawCityLabels()` 2D
   névtáblájának pontos mása (Cinzel, tulajdonos-színű keret, népesség-korong,
   fővároson ★). Azért DOM és nem textúra, mert a városnév tetszőleges szöveg,
   és élesnek kell maradnia — részletek a `js/render3d/labels3d.js` fejlécében.
   A z-index a HUD (35+) ALATT van: panel, tooltip, modális mindent takar. */
#labels3d {
  position: fixed; inset: 0; z-index: 6;
  pointer-events: none; overflow: hidden;
}
#labels3d .l3d {
  position: absolute; left: 0; top: 0;
  display: flex; align-items: center; gap: 5px;
  padding: 2px 9px 2px 2px;
  border: 1.6px solid var(--l3d-c, #d9b45f); border-radius: 5px;
  background: rgba(12, 16, 22, .80);
  font: 600 13px "Cinzel", Georgia, serif; color: #f2e9d8;
  white-space: nowrap; line-height: 1.25;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .75);
  transition: opacity .18s ease;
  will-change: transform;
}
#labels3d .l3d-pop {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--l3d-c, #d9b45f); color: #fff;
  font: bold 10px var(--hud-num, system-ui, sans-serif);
}
/* takarásban (hegy mögött) — halványan még mutatja, merre a város */
#labels3d .l3d.occl { opacity: .26; }

@media (prefers-reduced-motion: reduce) { #labels3d .l3d { transition: none; } }
