/* BIRODALMAK — UI stílus. Sötét obszidián + arany, üveges panelek.
   v0.2 — értesítés-oszlop, város-fülek, egység-portré, mobil parancssáv, a11y. */

:root {
  --gold: #d9b45f;
  --gold-2: #f0d290;
  --ink: #0b1017;
  --ink-2: #121a24;
  --panel: rgba(14, 20, 28, 0.90);
  --panel-2: rgba(20, 28, 38, 0.94);
  --line: rgba(217, 180, 95, 0.32);
  --line-soft: rgba(255, 255, 255, 0.09);
  --text: #f2ece0;          /* kontrasztosabb, mint a v0.1 #e9e2d3 */
  --text-dim: #b6b0a1;      /* AA-kontraszt a panel-háttéren */
  --good: #6fd18a;
  --bad: #e26a6a;
  --warn: #e8c14a;
  --sci: #5fc7e8;
  --cult: #c98ae0;
  --faith: #e8dfa8;
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.55);
  --focus: 0 0 0 2px #0b1017, 0 0 0 4px var(--gold-2);
  --tap: 44px;              /* minimális érintőcél */
  --r-s: 7px; --r-m: 9px; --r-l: 12px;
  --topbar-h: 58px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden; background: var(--ink); color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  user-select: none;
}
canvas#map { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
canvas#map.dragging { cursor: grabbing; }
.hidden { display: none !important; }
button { font-family: inherit; color: inherit; cursor: pointer; border: none; background: none; }

/* --- akadálymentesség: látható fókusz billentyűzetes navigációnál --- */
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-s); position: relative; z-index: 5; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ===================== FELSŐ SÁV ===================== */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 12px;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  background: linear-gradient(180deg, rgba(8, 12, 18, 0.97), rgba(8, 12, 18, 0.84));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  z-index: 40;
}
.tb-civ { display: flex; align-items: center; gap: 9px; min-width: 168px; }
.tb-banner {
  width: 36px; height: 36px; display: grid; place-items: center; font-size: 20px;
  background: linear-gradient(145deg, #2a3444, #161d27);
  border: 1px solid var(--line); border-radius: var(--r-m);
}
.tb-civ-name { font-family: Cinzel, Georgia, serif; font-weight: 700; font-size: 14px; letter-spacing: .3px; }
.tb-civ-leader { font-size: 11px; color: var(--text-dim); }

.tb-res { display: flex; gap: 6px; }
.res {
  display: flex; align-items: baseline; gap: 5px; padding: 5px 10px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line-soft);
  border-radius: 8px; font-size: 13px; font-variant-numeric: tabular-nums;
}
.res .ri { font-size: 14px; }
.res b { font-weight: 700; }
.res i { font-style: normal; font-size: 11px; color: var(--text-dim); }
.res i.pos { color: var(--good); }
.res i.neg { color: var(--bad); }
#resSci b { color: var(--sci); }
#resCult b { color: var(--cult); }
#resFaith b { color: var(--faith); }
#resGold b { color: var(--gold-2); }

.research-chip {
  display: flex; align-items: center; gap: 9px; padding: 6px 12px; min-width: 200px;
  background: rgba(95, 199, 232, 0.09); border: 1px solid rgba(95, 199, 232, 0.28);
  border-radius: var(--r-m); position: relative; overflow: hidden; transition: .15s;
}
.research-chip:hover { background: rgba(95, 199, 232, 0.16); }
.research-chip.empty { border-color: var(--warn); background: rgba(232, 193, 74, .14); animation: chipPulse 2s infinite; }
@keyframes chipPulse { 0%, 100% { box-shadow: none; } 50% { box-shadow: 0 0 0 1px rgba(232, 193, 74, .55); } }
.rc-icon { font-size: 16px; }
.rc-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; }
.rc-text b { font-size: 12.5px; }
.rc-text i { font-style: normal; font-size: 10.5px; color: var(--text-dim); }
.rc-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: rgba(255, 255, 255, 0.08); }
.rc-bar > span { display: block; height: 100%; width: 0; background: var(--sci); transition: width .3s; }

.tb-right { margin-left: auto; display: flex; align-items: center; gap: 7px; }
.tb-btns { display: flex; align-items: center; gap: 6px; }
.tb-btn {
  width: 38px; height: 38px; border-radius: var(--r-m); font-size: 17px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line-soft);
  transition: .15s; display: grid; place-items: center; position: relative;
}
.tb-btn:hover { background: rgba(217, 180, 95, 0.16); border-color: var(--line); }
.tb-btn .tb-dot {
  position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--warn); box-shadow: 0 0 0 2px rgba(8, 12, 18, .9);
}
.tb-more { display: none; }
.tb-turn { text-align: right; margin-left: 6px; min-width: 92px; }
.tb-turn b { display: block; font-size: 13px; font-family: Cinzel, serif; }
.tb-turn i { font-style: normal; font-size: 11px; color: var(--text-dim); }

/* ===================== VÁROS-FÜLEK ===================== */
/* Asztalon a toastok (bal, 310px) és a minitérkép (jobb) KÖZÉ feszül,
   így sosem takarja egyiket sem. Mobilon (≤900px) alulra kerül. */
#cityBar {
  position: fixed; top: 64px; left: 340px; right: 272px; z-index: 38;
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: 10px;
  box-shadow: var(--shadow); backdrop-filter: blur(8px); padding: 5px;
}
.cb-scroll {
  display: flex; gap: 5px; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.cb-scroll::-webkit-scrollbar { height: 5px; }
.cb-scroll::-webkit-scrollbar-thumb { background: rgba(217, 180, 95, .35); border-radius: 3px; }
.city-tab {
  flex: 0 0 auto; display: flex; align-items: center; gap: 7px;
  padding: 5px 9px; border-radius: 8px; min-height: 34px;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line-soft);
  transition: .14s; text-align: left; white-space: nowrap;
}
.city-tab:hover { background: rgba(217, 180, 95, .16); border-color: var(--line); }
.city-tab.cap { border-color: rgba(217, 180, 95, .45); }
.city-tab.idle { border-color: rgba(232, 193, 74, .6); background: rgba(232, 193, 74, .12); }
.city-tab .ct-ic { font-size: 15px; }
.city-tab .ct-txt { display: flex; flex-direction: column; line-height: 1.2; }
.city-tab .ct-txt b { font-size: 11.5px; font-family: Cinzel, serif; }
.city-tab .ct-txt i { font-style: normal; font-size: 10px; color: var(--text-dim); }
.city-tab .ct-turns {
  font-size: 10.5px; color: var(--gold-2); font-variant-numeric: tabular-nums;
  padding: 2px 6px; border-radius: 10px; background: rgba(217, 180, 95, .12);
}

/* ===================== ÁTFUTÓ ÉRTESÍTÉSEK (toast) ===================== */
#toasts {
  position: fixed; left: 12px; top: 70px; width: 310px; z-index: 45;
  display: flex; flex-direction: column; gap: 7px; pointer-events: none;
}
.toast {
  background: var(--panel); border: 1px solid var(--line); border-left-width: 3px;
  border-radius: 8px; padding: 8px 11px; font-size: 12.5px; box-shadow: var(--shadow);
  animation: slideIn .28s ease-out; line-height: 1.35;
}
.toast.good { border-left-color: var(--good); }
.toast.bad, .toast.war { border-left-color: var(--bad); }
.toast.warn { border-left-color: var(--warn); }
.toast.era { border-left-color: var(--gold); }
.toast.diplo { border-left-color: var(--cult); }
.toast.combat { border-left-color: #ef8f5a; }
.toast.fade { animation: fadeOut .45s forwards; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
@keyframes fadeOut { to { opacity: 0; transform: translateX(-14px); } }

/* ===================== TARTÓS ÉRTESÍTÉS-OSZLOP ===================== */
#notifCol {
  /* a `top`-ot a hud.js igazítja a minitérkép aljához (positionNotifCol) */
  position: fixed; right: 14px; top: 236px; z-index: 41;
  display: flex; flex-direction: column; gap: 7px; align-items: flex-end;
  max-height: 52vh; overflow-y: auto; overflow-x: hidden; padding: 2px;
  scrollbar-width: none;
}
#notifCol::-webkit-scrollbar { width: 0; }
.notif {
  display: flex; align-items: center; gap: 8px; padding: 0 10px 0 0;
  min-height: 42px; border-radius: 21px;
  background: var(--panel); border: 1px solid var(--line-soft);
  box-shadow: var(--shadow); backdrop-filter: blur(8px);
  transition: .16s; max-width: 62px; overflow: hidden;
}
.notif:hover, .notif:focus-visible { max-width: 320px; border-color: var(--line); background: var(--panel-2); }
.notif .nf-ic {
  flex: 0 0 auto; width: 42px; height: 42px; display: grid; place-items: center;
  font-size: 19px; border-radius: 50%; position: relative;
}
.notif .nf-txt {
  font-size: 12px; white-space: nowrap; opacity: 0; transition: opacity .16s; padding-right: 4px;
}
.notif:hover .nf-txt, .notif:focus-visible .nf-txt { opacity: 1; }
.notif .nf-count {
  position: absolute; top: -1px; right: -1px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; font-size: 10.5px; font-weight: 700; display: grid; place-items: center;
  background: var(--gold); color: #201704; box-shadow: 0 0 0 2px rgba(14, 20, 28, .95);
}
.notif.warn  { border-left: 3px solid var(--warn); }
.notif.sci   { border-left: 3px solid var(--sci); }
.notif.unit  { border-left: 3px solid var(--good); }
.notif.war   { border-left: 3px solid var(--bad); }
.notif.war .nf-count { background: var(--bad); color: #fff; }
.notif.pulse { animation: notifPulse 2.4s infinite; }
@keyframes notifPulse {
  0%, 100% { box-shadow: var(--shadow); }
  50% { box-shadow: var(--shadow), 0 0 0 2px rgba(232, 193, 74, .45); }
}

/* ===================== MEZŐ-INFÓ (tooltip) ===================== */
#tileInfo {
  position: fixed; z-index: 35; pointer-events: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 9px; font-size: 12px; box-shadow: var(--shadow); max-width: 250px;
  line-height: 1.4; animation: tiIn .12s ease-out;
}
@keyframes tiIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
#tileInfo .ti-name { font-family: Cinzel, serif; font-weight: 600; color: var(--gold-2); font-size: 12.5px; }
#tileInfo .ti-row { color: var(--text-dim); font-size: 11.5px; display: flex; gap: 5px; align-items: center; }
#tileInfo .ti-y { display: flex; gap: 8px; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
#tileInfo .ti-y span { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; }
#tileInfo .ti-meta {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 4px;
}
#tileInfo .ti-chip {
  font-size: 10.5px; padding: 1px 6px; border-radius: 10px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1);
}
#tileInfo .ti-chip.def { color: #a9d6ff; border-color: rgba(120, 180, 255, .3); }
#tileInfo .ti-chip.mv { color: #ffd9a0; border-color: rgba(232, 193, 74, .3); }
#tileInfo .ti-chip.no { color: #f0a0a0; border-color: rgba(226, 106, 106, .38); }
#tileInfo .ti-unit { display: flex; gap: 5px; align-items: center; font-size: 11.5px; margin-top: 2px; }
#tileInfo .ti-unit .u-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }

/* ===================== EGYSÉG / VÁROS PANEL ===================== */
#selPanel {
  position: fixed; left: 12px; bottom: 12px; width: 320px; z-index: 42;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l);
  box-shadow: var(--shadow); overflow: hidden; backdrop-filter: blur(8px);
}
.sp-head { display: flex; align-items: center; gap: 11px; padding: 11px 12px; background: rgba(255, 255, 255, 0.045); }
.sp-portrait {
  position: relative; width: 64px; height: 64px; flex: 0 0 auto; border-radius: 11px;
  background: radial-gradient(circle at 35% 28%, #2f3b4c, #131a24 72%);
  border: 1px solid var(--line); overflow: hidden;
}
#spPortrait { width: 64px; height: 64px; display: block; }
.sp-icon {
  position: absolute; right: -1px; bottom: -1px; width: 22px; height: 22px;
  display: grid; place-items: center; font-size: 12px; border-radius: 7px 0 10px 0;
  background: rgba(8, 12, 18, .88); border-top: 1px solid var(--line); border-left: 1px solid var(--line);
}
.sp-title { flex: 1; min-width: 0; }
.sp-title b { display: block; font-family: Cinzel, serif; font-size: 15px; }
.sp-title i { font-style: normal; font-size: 11.5px; color: var(--text-dim); display: block; line-height: 1.35; }
.sp-promo { display: flex; gap: 2px; margin-top: 3px; font-size: 11px; align-items: center; }
.sp-promo .star { color: var(--gold-2); text-shadow: 0 0 6px rgba(240, 210, 144, .5); }
.sp-promo .star.off { color: rgba(255, 255, 255, .16); text-shadow: none; }
.sp-promo .xp { font-size: 10px; color: var(--text-dim); margin-left: 4px; }
.sp-close {
  width: 28px; height: 28px; border-radius: var(--r-s); color: var(--text-dim); font-size: 13px;
  align-self: flex-start; flex: 0 0 auto;
}
.sp-close:hover { background: rgba(255, 255, 255, 0.10); color: #fff; }

.sp-bars { padding: 0 12px 8px; display: flex; flex-direction: column; gap: 5px; }
.sp-bar { display: flex; align-items: center; gap: 7px; font-size: 11px; }
.sp-bar .sb-lb { width: 15px; flex: 0 0 auto; font-size: 11px; }
.sp-bar .sb-track {
  flex: 1; height: 8px; border-radius: 5px; overflow: hidden;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .06);
}
.sp-bar .sb-fill { display: block; height: 100%; width: 100%; border-radius: 5px; transition: width .25s; }
.sp-bar.hp .sb-fill { background: linear-gradient(90deg, #6fd18a, #a8e6b8); }
.sp-bar.hp.mid .sb-fill { background: linear-gradient(90deg, #e8c14a, #f4dd93); }
.sp-bar.hp.low .sb-fill { background: linear-gradient(90deg, #e26a6a, #f0a0a0); }
.sp-bar.mp .sb-fill { background: linear-gradient(90deg, #5fc7e8, #a8e3f4); }
.sp-bar.mp.spent .sb-fill { background: rgba(255, 255, 255, .18); }
.sp-bar.food .sb-fill { background: linear-gradient(90deg, #6fd18a, #cfe89a); }
.sp-bar .sb-val { width: 46px; text-align: right; color: var(--text-dim); font-variant-numeric: tabular-nums; }

.sp-switch { display: flex; gap: 5px; padding: 0 12px 8px; flex-wrap: wrap; }
.sp-switch:empty { display: none; }
.usw {
  display: flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 14px;
  font-size: 11px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line-soft);
  transition: .13s; min-height: 26px;
}
.usw:hover { background: rgba(217, 180, 95, .18); }
.usw.on { border-color: var(--gold); background: rgba(217, 180, 95, .2); }
.usw .uw-hp { width: 4px; height: 14px; border-radius: 2px; background: var(--good); }

.sp-stats { display: flex; flex-wrap: wrap; gap: 6px; padding: 9px 12px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.sp-stats:empty { display: none; }
.sp-stat {
  font-size: 11.5px; padding: 3px 8px; border-radius: 6px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line-soft);
}
.sp-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 12px 12px; }
.act-btn {
  display: flex; align-items: center; gap: 7px; padding: 8px 9px; font-size: 12.5px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line-soft);
  border-radius: 8px; transition: .14s; text-align: left; min-height: 36px; position: relative;
}
.act-btn:hover:not(:disabled) { background: rgba(217, 180, 95, 0.18); border-color: var(--line); transform: translateY(-1px); }
.act-btn:disabled { opacity: .38; cursor: not-allowed; }
.act-btn.danger:hover:not(:disabled) { background: rgba(226, 106, 106, 0.20); border-color: rgba(226, 106, 106, .5); }
.act-btn .ai { font-size: 15px; flex: 0 0 auto; }
.act-btn .al { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-btn .ak {
  flex: 0 0 auto; font-size: 9.5px; font-family: ui-monospace, monospace; line-height: 1;
  padding: 2px 4px; border-radius: 4px; color: var(--text-dim);
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12);
}
.sp-hint { grid-column: 1 / -1; font-size: 10.5px; color: var(--text-dim); text-align: center; padding-top: 2px; }

/* ===================== MOBIL PARANCSSÁV ===================== */
#mobBar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 44;
  background: linear-gradient(0deg, rgba(8, 12, 18, .98), rgba(8, 12, 18, .90));
  border-top: 1px solid var(--line);
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  backdrop-filter: blur(10px);
  flex-direction: column; gap: 6px;
}
.mob-unit { display: flex; align-items: center; gap: 8px; font-size: 12px; min-height: 20px; }
.mob-unit b { font-family: Cinzel, serif; font-size: 13px; }
.mob-unit .mu-bar { flex: 1; height: 6px; border-radius: 4px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.mob-unit .mu-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #6fd18a, #a8e6b8); }
.mob-actions { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.mob-actions::-webkit-scrollbar { height: 0; }
.mob-act {
  flex: 0 0 auto; min-width: var(--tap); min-height: var(--tap);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 5px 10px; border-radius: 10px; font-size: 10px;
  background: rgba(255, 255, 255, .07); border: 1px solid var(--line-soft);
}
.mob-act .ai { font-size: 19px; }
.mob-act:disabled { opacity: .35; }
.mob-act.danger { border-color: rgba(226, 106, 106, .4); }

/* ===================== KÖR VÉGE ===================== */
#turnBox {
  position: fixed; right: 14px; bottom: 14px; z-index: 43;
  display: flex; align-items: flex-end; gap: 9px;
}
#btnIdle {
  padding: 10px 13px; font-size: 12.5px; border-radius: var(--r-m); min-height: 40px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
}
#btnIdle:hover { background: rgba(217, 180, 95, 0.18); }
#btnEnd {
  padding: 13px 26px; border-radius: 11px; font-family: Cinzel, serif; font-weight: 700; letter-spacing: .6px;
  background: linear-gradient(160deg, #d9b45f, #a8822f); color: #201704;
  border: 1px solid #f0d290; box-shadow: 0 8px 26px rgba(217, 180, 95, .30); transition: .16s;
  display: flex; flex-direction: column; align-items: center; line-height: 1.15; min-height: var(--tap);
}
#btnEnd small { font-family: Inter, sans-serif; font-weight: 500; font-size: 10px; opacity: .65; letter-spacing: 0; }
#btnEnd:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(217, 180, 95, .42); }
#btnEnd.waiting { background: linear-gradient(160deg, #4a5768, #2c3543); color: #e3e9f1; border-color: #5d6b7e; }
#btnEnd.attention { animation: pulseBtn 1.5s infinite; }
@keyframes pulseBtn { 0%, 100% { box-shadow: 0 8px 26px rgba(217, 180, 95, .30); } 50% { box-shadow: 0 8px 34px rgba(240, 210, 144, .65); } }

/* ===================== FPS-MÉRŐ ===================== */
/* A felső sáv jobb szélén, a kör-számláló ELŐTT — flex-elemként, nem lebegve,
   így garantáltan nem takar rá a „N. kör" feliratra. */
#fpsMeter {
  flex: 0 0 auto; margin-left: 6px; pointer-events: none; user-select: none;
  font: 600 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .04em; padding: 4px 6px; border-radius: 6px; white-space: nowrap;
  color: var(--text-dim); background: rgba(8, 12, 18, .55);
  border: 1px solid var(--line); opacity: .8;
}
#fpsMeter[data-lvl="ok"]  { color: #7fd28a; }
#fpsMeter[data-lvl="mid"] { color: #e8c46a; }
#fpsMeter[data-lvl="low"] { color: #e8836a; }

/* ===================== MINITÉRKÉP ===================== */
#minimapBox {
  position: fixed; right: 14px; top: 70px; z-index: 40;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px; box-shadow: var(--shadow); backdrop-filter: blur(8px);
}
.mm-head {
  display: flex; align-items: center; gap: 4px; padding: 0 2px 5px;
  font-size: 10.5px; color: var(--text-dim); letter-spacing: .4px;
}
.mm-title { flex: 1; text-transform: uppercase; font-size: 9.5px; }
.mm-ic {
  width: 22px; height: 22px; border-radius: 5px; font-size: 11px; color: var(--text-dim);
  display: grid; place-items: center; border: 1px solid transparent;
}
.mm-ic:hover { background: rgba(217, 180, 95, .2); color: var(--text); }
#minimapBox.folded #minimap,
#minimapBox.folded .mm-tools { display: none; }
#minimapBox.folded { padding-bottom: 3px; }
#minimapBox.folded #btnMmFold { transform: rotate(-90deg); }
#minimap { display: block; border-radius: 5px; cursor: crosshair; background: #3a3223; touch-action: none; }
#minimap.panning { cursor: grabbing; }
.mm-tools { display: flex; gap: 5px; margin-top: 6px; }
.mm-tools button {
  flex: 1; min-height: 28px; padding: 5px 0; font-size: 12px; border-radius: 6px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.08);
}
.mm-tools button:hover { background: rgba(217, 180, 95, 0.18); }
.mm-tools button.on { background: rgba(217, 180, 95, 0.28); border-color: var(--line); }

/* ===================== MODÁLIS ===================== */
/* A 78 SZÁNDÉKOS: a főmenü (#menu, 70) és az indító cím (#intro, 75) FÖLÉ kell kerülnie,
   különben a főmenüből nyitott képernyők (Mentések, Forgatókönyvek, Közös játék, Hogyan
   játssz?) a menü alatt rajzolódnak ki és úgy tűnik, a gomb nem csinál semmit.
   A betöltő-képernyő (#loading, 80) viszont maradjon fölötte. */
#modal {
  position: fixed; inset: 0; z-index: 78; display: grid; place-items: center;
  background: rgba(4, 8, 13, 0.74); backdrop-filter: blur(4px); animation: fadeIn .18s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); max-width: min(1080px, 94vw); max-height: 88vh; overflow: auto;
  padding: 0; animation: popIn .2s ease-out;
}
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
.mc-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 18px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel-2); z-index: 2;
}
.mc-head h2 { margin: 0; font-family: Cinzel, serif; font-size: 19px; letter-spacing: .4px; }
.mc-head .mc-x { margin-left: auto; width: 34px; height: 34px; border-radius: var(--r-s); font-size: 15px; color: var(--text-dim); }
.mc-head .mc-x:hover { background: rgba(255, 255, 255, .10); color: #fff; }
.mc-body { padding: 16px 18px 20px; }

/* --- város-képernyő --- */
.city-grid { display: grid; grid-template-columns: 300px 1fr; gap: 18px; min-width: min(880px, 88vw); }
.city-yields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 14px; }
.cy {
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px; padding: 8px; text-align: center;
}
.cy b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.cy i { font-style: normal; font-size: 10.5px; color: var(--text-dim); }
/* FIGYELEM: `display:block` KELL — több képernyő <span class="bar">-t használ,
   és inline elemen a magasság nem érvényesül (szétnyúlt sávok voltak). */
.bar { display: block; height: 8px; background: rgba(255, 255, 255, .07); border-radius: 5px; overflow: hidden; margin: 5px 0 3px; }
.bar > span { display: block; height: 100%; border-radius: 5px; transition: width .3s; }
.bar.food > span { background: linear-gradient(90deg, #6fd18a, #a8e6b8); }
.bar.prod > span { background: linear-gradient(90deg, #e0a04a, #f2c98a); }
.bar.cult > span { background: linear-gradient(90deg, #c98ae0, #e2bcf0); }
.sec-title {
  font-family: Cinzel, serif; font-size: 13px; color: var(--gold-2);
  margin: 14px 0 8px; letter-spacing: .5px; text-transform: uppercase;
}
.prod-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 7px; }
.prod-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--r-m);
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .08); transition: .14s;
  min-height: 40px;
}
.prod-item:hover:not(.off) { background: rgba(217, 180, 95, .16); border-color: var(--line); transform: translateY(-1px); }
.prod-item.off { opacity: .42; cursor: not-allowed; }
.prod-item .pi-ic { font-size: 19px; }
.prod-item .pi-txt { flex: 1; min-width: 0; }
.prod-item .pi-txt b { display: block; font-size: 12.5px; }
.prod-item .pi-txt i { font-style: normal; font-size: 10.5px; color: var(--text-dim); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod-item .pi-cost { font-size: 11.5px; color: var(--gold-2); font-variant-numeric: tabular-nums; text-align: right; }
.bld-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bld-chip {
  font-size: 11.5px; padding: 4px 9px; border-radius: 20px;
  background: rgba(111, 209, 138, .12); border: 1px solid rgba(111, 209, 138, .28);
}

/* --- tech-fa --- */
.tech-eras { display: flex; gap: 18px; overflow-x: auto; padding-bottom: 8px; }
.tech-era { min-width: 218px; }
.tech-era h4 {
  margin: 0 0 9px; font-family: Cinzel, serif; font-size: 13px; color: var(--gold-2);
  text-transform: uppercase; letter-spacing: .6px;
}
.tech-card {
  display: flex; gap: 9px; align-items: flex-start; padding: 9px 10px; margin-bottom: 7px;
  border-radius: var(--r-m); background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08); transition: .14s;
}
.tech-card:hover:not(.locked) { background: rgba(95, 199, 232, .16); border-color: rgba(95, 199, 232, .4); transform: translateX(2px); }
.tech-card.done { background: rgba(111, 209, 138, .12); border-color: rgba(111, 209, 138, .3); }
.tech-card.active { background: rgba(95, 199, 232, .2); border-color: var(--sci); box-shadow: 0 0 0 1px rgba(95, 199, 232, .3); }
.tech-card.locked { opacity: .40; cursor: not-allowed; }
.tech-card .tc-ic { font-size: 18px; }
.tech-card b { display: block; font-size: 12.5px; }
.tech-card i { font-style: normal; font-size: 10.5px; color: var(--text-dim); }

/* --- diplomácia / napló --- */
.civ-row {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; margin-bottom: 7px;
  border-radius: var(--r-m); background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .08);
}
.civ-dot { width: 13px; height: 13px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(0, 0, 0, .35); }
.civ-row .cr-txt { flex: 1; }
.civ-row .cr-txt b { display: block; font-size: 13px; font-family: Cinzel, serif; }
.civ-row .cr-txt i { font-style: normal; font-size: 11px; color: var(--text-dim); }
.state-pill { font-size: 11px; padding: 3px 10px; border-radius: 20px; }
.state-pill.war { background: rgba(226, 106, 106, .18); border: 1px solid rgba(226, 106, 106, .45); color: #f0a0a0; }
.state-pill.peace { background: rgba(111, 209, 138, .14); border: 1px solid rgba(111, 209, 138, .35); color: #a6e6bb; }
.state-pill.unknown { background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); color: var(--text-dim); }
.mini-btn {
  font-size: 11.5px; padding: 6px 12px; border-radius: var(--r-s); min-height: 32px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12);
}
.mini-btn:hover { background: rgba(217, 180, 95, .2); }

/* --- napló: szűrők + lista --- */
.log-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.log-filter {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 18px;
  font-size: 12px; min-height: 32px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line-soft); transition: .14s;
}
.log-filter:hover { background: rgba(217, 180, 95, .16); }
.log-filter.on { background: rgba(217, 180, 95, .22); border-color: var(--gold); color: var(--gold-2); }
.log-filter .lf-n { font-size: 10.5px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.log-filter.on .lf-n { color: var(--gold-2); }
.log-list { max-height: 58vh; overflow: auto; min-width: min(560px, 86vw); }
.log-line {
  padding: 7px 10px; font-size: 12px; border-left: 2px solid rgba(255, 255, 255, .1);
  margin-bottom: 4px; line-height: 1.45; border-radius: 0 6px 6px 0;
  background: rgba(255, 255, 255, .022);
}
.log-line span.lg-t { color: var(--text-dim); font-size: 10.5px; margin-right: 6px; font-variant-numeric: tabular-nums; }
.log-line.good { border-left-color: var(--good); }
.log-line.bad, .log-line.war, .log-line.combat { border-left-color: var(--bad); }
.log-line.warn { border-left-color: var(--warn); }
.log-line.diplo { border-left-color: var(--cult); }
.log-line.era { border-left-color: var(--gold); }
.log-empty { color: var(--text-dim); font-size: 12.5px; padding: 18px 4px; text-align: center; }

/* ===================== FŐMENÜ ===================== */
#menu { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; overflow: auto; }
#menuBg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.menu-bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(1100px 620px at 50% 8%, rgba(217, 180, 95, .16), transparent 62%),
    radial-gradient(800px 500px at 15% 90%, rgba(95, 199, 232, .10), transparent 60%),
    linear-gradient(180deg, rgba(10, 15, 22, .35), rgba(5, 9, 14, .78));
}
.menu-bg::after {
  content: ''; position: absolute; inset: 0; opacity: .22;
  background-image:
    linear-gradient(30deg, transparent 47%, rgba(217, 180, 95, .09) 49%, transparent 51%),
    linear-gradient(-30deg, transparent 47%, rgba(217, 180, 95, .06) 49%, transparent 51%);
  background-size: 68px 118px;
}
.menu-inner { position: relative; text-align: center; padding: 34px 20px; width: min(760px, 94vw); }
.game-title {
  font-family: Cinzel, serif; font-size: clamp(38px, 8vw, 74px); font-weight: 700;
  margin: 0; letter-spacing: 9px;
  background: linear-gradient(180deg, #f8ecc8, #d9b45f 55%, #9d7a2c);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 6px 40px rgba(217, 180, 95, .28);
}
.game-sub { margin: 4px 0 26px; color: var(--text-dim); font-size: 13px; letter-spacing: 2px; text-transform: uppercase; }
.menu-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
  backdrop-filter: blur(6px);
}
.mbtn {
  padding: 13px 18px; font-size: 14.5px; border-radius: 10px; font-family: Cinzel, serif; letter-spacing: .4px;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); transition: .16s;
  min-height: var(--tap);
}
.mbtn:hover:not(:disabled) { background: rgba(217, 180, 95, .18); border-color: var(--line); transform: translateY(-1px); }
.mbtn:disabled { opacity: .35; cursor: not-allowed; }
.mbtn.primary { background: linear-gradient(160deg, #d9b45f, #a8822f); color: #201704; border-color: #f0d290; font-weight: 700; }
.mbtn.primary:hover { box-shadow: 0 10px 28px rgba(217, 180, 95, .35); }
.menu-panel h3 { margin: 6px 0 2px; font-family: Cinzel, serif; font-size: 13px; color: var(--gold-2); letter-spacing: .8px; text-transform: uppercase; }
.civ-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 8px; }
.civ-card {
  display: flex; gap: 9px; align-items: center; padding: 9px 10px; border-radius: 10px; text-align: left;
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .09); transition: .14s;
  min-height: var(--tap);
}
.civ-card:hover { transform: translateY(-2px); background: rgba(255, 255, 255, .08); }
.civ-card.on { border-color: var(--gold); background: rgba(217, 180, 95, .16); box-shadow: 0 0 0 1px rgba(217, 180, 95, .3); }
.civ-card .cc-b { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-size: 17px; }
.civ-card .cc-t b { display: block; font-size: 12px; font-family: Cinzel, serif; }
.civ-card .cc-t i { font-style: normal; font-size: 10.5px; color: var(--text-dim); }
.size-row { display: flex; gap: 8px; }
.size-row button {
  flex: 1; padding: 10px; border-radius: var(--r-m); font-size: 13px; min-height: var(--tap);
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .09);
  display: flex; flex-direction: column; gap: 2px; align-items: center; justify-content: center;
}
.size-row button small { font-size: 10px; color: var(--text-dim); }
.size-row button.on { border-color: var(--gold); background: rgba(217, 180, 95, .16); }
.setup-actions { display: flex; gap: 9px; margin-top: 8px; }
.setup-actions .mbtn { flex: 1; }
.civ-trait { font-size: 12px; color: var(--text-dim); margin-top: 4px; line-height: 1.45; }

/* ===================== BETÖLTÉS ===================== */
#loading {
  position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; padding: 24px;
  background:
    radial-gradient(700px 420px at 50% 45%, rgba(217, 180, 95, .10), transparent 65%),
    rgba(5, 9, 14, .95);
  font-family: Cinzel, serif; letter-spacing: 2px; font-size: 14px; text-align: center;
}
#loading small {
  font-family: Inter, sans-serif; letter-spacing: 0; font-size: 12px;
  color: var(--text-dim); max-width: 360px; line-height: 1.5;
}
.spinner {
  width: 46px; height: 46px; border: 3px solid rgba(217, 180, 95, .18);
  border-top-color: var(--gold); border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===================== SÚGÓ ===================== */
.help-body { max-width: 680px; line-height: 1.6; font-size: 13.5px; }
.help-body p { margin: 0 0 10px; }
.help-body h4 { font-family: Cinzel, serif; color: var(--gold-2); margin: 18px 0 7px; font-size: 13.5px; letter-spacing: .5px; }
.help-body ul { margin: 0; padding-left: 20px; color: var(--text); }
.help-body li { margin-bottom: 5px; }
.help-body kbd {
  background: rgba(255, 255, 255, .10); border: 1px solid rgba(255, 255, 255, .18);
  border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px; font-size: 11.5px;
  font-family: ui-monospace, monospace; color: var(--gold-2); white-space: nowrap;
}
.help-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.key-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.key-table td { padding: 5px 8px; border-bottom: 1px solid rgba(255, 255, 255, .06); vertical-align: top; }
.key-table td:first-child { width: 130px; white-space: nowrap; }
.tip-list { counter-reset: tip; list-style: none; padding: 0; margin: 0; }
.tip-list li {
  counter-increment: tip; position: relative; padding: 5px 0 5px 30px; font-size: 12.5px; line-height: 1.5;
}
.tip-list li::before {
  content: counter(tip); position: absolute; left: 0; top: 5px;
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: 10.5px; font-weight: 700; color: #201704;
  background: linear-gradient(160deg, #d9b45f, #a8822f);
}
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }

/* ===================== MOBIL / ÉRINTÉS ===================== */

/* --- tablet és kisebb --- */
@media (max-width: 900px) {
  :root { --topbar-h: 50px; }

  #topbar { gap: 8px; padding: 0 8px; }
  .tb-civ { min-width: 0; }
  .tb-civ-text { display: none; }
  .tb-banner { width: 32px; height: 32px; font-size: 17px; }
  .research-chip { min-width: 0; flex: 1; max-width: 190px; padding: 5px 9px; }
  .rc-text b { font-size: 11.5px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rc-text i { display: none; }
  .res { padding: 4px 7px; font-size: 12px; }
  #resFaith, #resCult { display: none; }

  /* összecsukható gombsor: alapból rejtve, a „több" gomb nyitja */
  .tb-btns {
    display: none; position: fixed; top: var(--topbar-h); right: 6px;
    flex-direction: column; gap: 6px; padding: 7px; z-index: 46;
    background: var(--panel-2); border: 1px solid var(--line); border-radius: 0 0 12px 12px;
    box-shadow: var(--shadow);
  }
  body.tb-open .tb-btns { display: flex; }
  .tb-btn { width: var(--tap); height: var(--tap); font-size: 19px; }
  .tb-more {
    display: grid; place-items: center; width: var(--tap); height: 40px; font-size: 20px;
    border-radius: var(--r-m); background: rgba(255, 255, 255, .06); border: 1px solid var(--line-soft);
  }
  body.tb-open .tb-more { background: rgba(217, 180, 95, .24); border-color: var(--line); }
  .tb-turn { min-width: 0; margin-left: 2px; }
  .tb-turn i { display: none; }
  #fpsMeter { display: none; }   /* keskeny sávon nincs rá hely */

  #minimapBox { top: calc(var(--topbar-h) + 6px); right: 6px; }
  /* a canvas oldalarányát a JS állítja a világ méretéhez — itt csak lekicsinyítjük */
  #minimap { max-width: min(172px, 44vw); height: auto; }
  #toasts { width: min(58vw, 240px); top: calc(var(--topbar-h) + 6px); left: 8px; }
  #notifCol { right: 8px; }

  /* város-fülek: alul, a parancssáv fölött */
  #cityBar {
    top: auto; bottom: calc(env(safe-area-inset-bottom) + 8px);
    left: 8px; right: 96px;
  }
  body.has-sel #cityBar { bottom: calc(env(safe-area-inset-bottom) + 122px); }
  .city-tab { min-height: 40px; }

  #selPanel { width: calc(100vw - 16px); left: 8px; bottom: 8px; }
  #turnBox { right: 8px; bottom: calc(env(safe-area-inset-bottom) + 8px); flex-direction: column; align-items: flex-end; gap: 6px; }
  #btnEnd { padding: 12px 18px; font-size: 13px; min-width: 84px; }
  .city-grid { grid-template-columns: 1fr; min-width: 0; }
  .help-cols { grid-template-columns: 1fr; }
}

/* --- telefon: alsó fix parancssáv, teljes képernyős modálisok --- */
@media (max-width: 700px) {
  /* a részletes bal-alsó panel helyett az alsó parancssáv megy */
  body.playing #selPanel { display: none !important; }
  body.playing.has-sel #mobBar { display: flex; }

  #turnBox { bottom: calc(env(safe-area-inset-bottom) + 10px); }
  body.has-sel #turnBox { bottom: calc(env(safe-area-inset-bottom) + 118px); }
  #btnEnd { padding: 14px 20px; font-size: 14px; min-height: 56px; min-width: 96px; }
  #btnIdle { min-height: var(--tap); padding: 10px 14px; }

  #cityBar { right: 108px; }
  body.has-sel #cityBar { bottom: calc(env(safe-area-inset-bottom) + 128px); }

  #notifCol { max-height: 40vh; }
  .notif { max-width: var(--tap); min-height: var(--tap); padding: 0; }
  .notif .nf-ic { width: var(--tap); height: var(--tap); font-size: 20px; }
  .notif:hover, .notif:focus-visible { max-width: min(76vw, 300px); padding: 0 10px 0 0; }

  /* teljes képernyős modálisok */
  #modal { place-items: stretch; }
  .modal-card {
    max-width: 100vw; width: 100vw; max-height: 100vh; height: 100%;
    border-radius: 0; border: none; animation: sheetIn .22s ease-out;
  }
  @keyframes sheetIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
  .mc-head { padding: 12px 14px; padding-top: max(12px, env(safe-area-inset-top)); }
  .mc-head h2 { font-size: 16px; }
  .mc-head .mc-x { width: var(--tap); height: var(--tap); }
  .mc-body { padding: 12px 14px calc(24px + env(safe-area-inset-bottom)); }
  .log-list { max-height: none; min-width: 0; }
  .prod-list { grid-template-columns: 1fr; }
  .tech-era { min-width: 200px; }

  .menu-inner { padding: 20px 12px 40px; }
  .civ-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .size-row { flex-direction: column; }
  .setup-actions { flex-direction: column; }
}

/* --- érintőképernyő: MINDEN kattintható elem legalább 44 px --- */
@media (pointer: coarse), (max-width: 900px) {
  .tb-btn, .tb-more, .mm-ic, .sp-close, .mc-head .mc-x { min-width: var(--tap); min-height: var(--tap); }
  .mm-ic { width: var(--tap); height: var(--tap); font-size: 13px; }
  .sp-close { width: var(--tap); height: var(--tap); }
  .mm-tools button { min-height: var(--tap); font-size: 15px; }
  .city-tab, .act-btn, .log-filter, .mini-btn, .usw, .notif, .prod-item, .tech-card, .civ-row .mini-btn {
    min-height: var(--tap);
  }
  .usw { padding: 6px 11px; }
  .log-filter { padding: 9px 14px; }
  .notif .nf-ic { width: var(--tap); height: var(--tap); }
  .size-row button, .civ-card, .mbtn { min-height: 48px; }
}

/* --- fekvő tájoló, alacsony képernyő: kompakt magasságok --- */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --topbar-h: 44px; }
  #topbar { gap: 6px; }
  .tb-banner { width: 28px; height: 28px; font-size: 15px; }
  .tb-btn { width: 40px; height: 40px; }
  #minimapBox { top: calc(var(--topbar-h) + 4px); }
  #minimap { max-width: min(136px, 26vw); height: auto; }
  #notifCol { max-height: 34vh; }
  #mobBar { padding: 4px 8px calc(4px + env(safe-area-inset-bottom)); }
  .mob-unit { display: none; }
  .mob-act { min-height: 42px; padding: 4px 9px; }
  #cityBar { left: 8px; right: 220px; }
  body.has-sel #cityBar { bottom: calc(env(safe-area-inset-bottom) + 60px); }
  body.has-sel #turnBox { bottom: calc(env(safe-area-inset-bottom) + 60px); }
  .modal-card { max-height: 100vh; }
  .menu-inner { padding: 14px 12px 26px; }
  .game-title { font-size: clamp(28px, 6vw, 44px); letter-spacing: 6px; }
  .game-sub { margin-bottom: 14px; }
}

/* --- nagyon keskeny telefon --- */
@media (max-width: 400px) {
  #resSci { display: none; }
  .research-chip { max-width: 130px; }
  #cityBar { right: 96px; }
}

/* ===================== MOZGÁS-CSÖKKENTÉS / A11Y ===================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .spinner { animation: spin 1.6s linear infinite !important; }
  #btnEnd:hover, .act-btn:hover, .mbtn:hover, .civ-card:hover, .prod-item:hover { transform: none !important; }
}

@media (prefers-contrast: more) {
  :root { --panel: rgba(8, 12, 18, 0.98); --panel-2: rgba(12, 18, 26, 0.99); --text-dim: #d3cec2; --line-soft: rgba(255, 255, 255, 0.24); }
}

/* harc-előrejelzés a mező-tooltipben */
#tileInfo .ti-fight {
  margin-top: 6px; padding: 6px 8px; border-radius: 6px; line-height: 1.4;
  background: rgba(226, 106, 106, .12); border: 1px solid rgba(226, 106, 106, .32);
}
#tileInfo .ti-fight.good { background: rgba(111, 209, 138, .12); border-color: rgba(111, 209, 138, .34); }
#tileInfo .ti-fight.warn { background: rgba(232, 193, 74, .12); border-color: rgba(232, 193, 74, .34); }

/* széles képernyők (város, technológia, társadalom) — különben a jobb oszlop levágódik */
.modal-card.wide { max-width: min(1340px, 96vw); }
.modal-card.wide .mc-body { padding-left: 14px; padding-right: 14px; }

/* ===================== INDÍTÓ CÍM ===================== */
#intro {
  position: fixed; inset: 0; z-index: 75; display: grid; place-items: center;
  pointer-events: none; background: radial-gradient(closest-side, rgba(5,9,14,.72), rgba(5,9,14,0) 78%);
  opacity: 0;
}
#intro.run { animation: introFade 3.4s ease-in-out forwards; }
#intro span {
  font-family: Cinzel, Georgia, serif; font-weight: 700;
  font-size: clamp(34px, 8vw, 82px); letter-spacing: clamp(6px, 2.2vw, 18px);
  background: linear-gradient(180deg, #f8ecc8, #d9b45f 55%, #9d7a2c);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 8px 50px rgba(217, 180, 95, .35);
  transform: scale(.94);
  animation: introZoom 3.4s ease-out forwards;
}
@keyframes introFade {
  0%   { opacity: 0; }
  22%  { opacity: 1; }
  68%  { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes introZoom { from { transform: scale(.94); } to { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) {
  #intro.run { animation: introFade 1.6s linear forwards; }
  #intro span { animation: none; transform: none; }
}

/* 3D nézet vászna — a 2D térkép fölött/helyett, ugyanazon a helyen */
canvas#map3d { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
canvas#map3d.dragging { cursor: grabbing; }
