/* ============================================================
   EPOCHS — Rise of Empires · HUD styling
   ============================================================ */
:root {
  --panel: linear-gradient(180deg, #2b2318 0%, #1c1710 100%);
  --edge: #6b5330;
  --gold: #e8c34a;
  --ink: #f0e6d2;
  --muted: #a89878;
}
* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #000; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  cursor: default;
}
body.atkcursor { cursor: crosshair; }

#gl { position: fixed; inset: 0; display: block; }
#vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 4;
  background: radial-gradient(ellipse at 50% 42%, transparent 52%, rgba(8, 14, 24, .30) 100%);
}
#overlay { position: fixed; inset: 0; pointer-events: none; z-index: 5; }

/* ---------------- top bar ---------------- */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; gap: 18px;
  padding: 6px 12px;
  background: var(--panel);
  border-bottom: 2px solid var(--edge);
  box-shadow: 0 3px 14px rgba(0,0,0,.5);
  font-size: 14px;
}
.resgrp { display: flex; gap: 14px; }
.res { display: flex; align-items: center; gap: 5px; min-width: 74px; }
.res i { font-style: normal; font-size: 15px; }
.res b { font-weight: 600; font-variant-numeric: tabular-nums; }
.res.warn b, .warn b { color: #ff6c5c; }
#agebadge {
  font-family: Georgia, serif; font-weight: 700; letter-spacing: .06em;
  color: var(--gold);
  padding: 2px 14px;
  border: 1px solid var(--edge); border-radius: 20px;
  background: rgba(0,0,0,.25);
  white-space: nowrap;
}
#wondertimer { color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; }
.topbtns { margin-left: auto; display: flex; gap: 6px; }
.topbtns button {
  font: inherit; color: var(--ink);
  background: rgba(255,255,255,.06);
  border: 1px solid var(--edge); border-radius: 6px;
  min-width: 34px; height: 28px; padding: 0 8px;
  cursor: pointer;
}
.topbtns button:hover { background: rgba(255,255,255,.14); }

/* age progress */
#ageprog {
  position: fixed; top: 46px; left: 50%; transform: translateX(-50%);
  width: 320px; height: 18px; z-index: 10; display: none;
  background: rgba(10,8,5,.8);
  border: 1px solid var(--edge); border-radius: 10px;
  overflow: hidden;
}
#ageprogfill { height: 100%; background: linear-gradient(90deg, #8a6a2f, var(--gold)); transition: width .3s; }
#ageproglabel {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #fff; text-shadow: 0 1px 2px #000;
}

/* ---------------- alerts / banner ---------------- */
#alerts {
  position: fixed; top: 56px; left: 12px; z-index: 9;
  display: flex; flex-direction: column; gap: 6px;
  pointer-events: none;
}
.toastmsg {
  background: rgba(20,16,10,.88);
  border: 1px solid var(--edge); border-left: 3px solid var(--gold);
  border-radius: 6px;
  padding: 6px 12px; font-size: 13px;
  animation: slidein .25s ease;
  max-width: 320px;
}
.toastmsg.fade { opacity: 0; transition: opacity .5s; }
@keyframes slidein { from { transform: translateX(-16px); opacity: 0; } }

#banner {
  position: fixed; top: 26%; left: 50%; transform: translate(-50%, -50%) scale(.9);
  z-index: 20; text-align: center; pointer-events: none;
  opacity: 0; transition: all .5s ease;
}
#banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#banner .btitle {
  font-family: Georgia, serif; font-size: 54px; font-weight: 700;
  color: var(--gold);
  text-shadow: 0 2px 8px rgba(0,0,0,.8), 0 0 40px rgba(232,195,74,.35);
  letter-spacing: .08em;
}
#banner .bsub { font-size: 16px; color: #fff; text-shadow: 0 1px 4px #000; margin-top: 6px; }

/* ---------------- bottom bar ---------------- */
#bottombar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: stretch; gap: 10px;
  padding: 8px 10px;
  background: var(--panel);
  border-top: 2px solid var(--edge);
  box-shadow: 0 -3px 14px rgba(0,0,0,.5);
  min-height: 148px; max-height: 190px;
}
#selinfo { width: 240px; flex-shrink: 0; padding: 4px 6px; overflow: hidden; }
.selname { font-family: Georgia, serif; font-size: 17px; color: var(--gold); margin-bottom: 6px; }
.selname .foe { color: #ff6c5c; font-size: 12px; }
.hpline { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.hpbar { width: 120px; height: 9px; background: #171310; border: 1px solid #000; border-radius: 4px; overflow: hidden; }
.hpbar div { height: 100%; background: linear-gradient(180deg, #7ede82, #4aa64e); }
.selstats { margin-top: 8px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.hint { font-size: 12px; color: var(--muted); padding-top: 24px; line-height: 1.7; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  display: flex; align-items: center; gap: 3px;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--edge); border-radius: 6px;
  padding: 3px 8px; font-size: 14px; cursor: pointer;
}
.chip:hover { background: rgba(255,255,255,.15); }
.chip b { font-size: 12px; color: var(--gold); }

#cmdcard { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 0 4px; }
.cardtitle {
  font-size: 10px; text-transform: uppercase; letter-spacing: .14em;
  color: var(--muted); margin: 4px 0 3px;
}
.btngrid { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.btn {
  width: 64px; height: 58px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #3a2f1e, #241d12);
  border: 1px solid var(--edge); border-radius: 8px;
  cursor: pointer;
  transition: transform .07s;
  position: relative;
}
.btn.wide { width: 138px; }
.btn:hover { border-color: var(--gold); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn.disabled { opacity: .38; filter: grayscale(.6); cursor: not-allowed; }
.bicon { font-size: 20px; line-height: 1.1; }
.blabel { font-size: 9.5px; color: var(--ink); white-space: nowrap; overflow: hidden; max-width: 60px; }
.bcost { font-size: 8.5px; color: var(--muted); white-space: nowrap; transform: scale(.92); }
.queue { display: flex; gap: 5px; margin-top: 6px; }
.qitem {
  width: 42px; height: 40px;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  background: rgba(0,0,0,.35);
  border: 1px solid var(--gold); border-radius: 6px;
  font-size: 17px; cursor: pointer;
}
.qitem:hover { background: rgba(224,72,62,.3); }
.qpct { font-size: 9px; color: var(--gold); }

#minimapwrap {
  position: relative; flex-shrink: 0;
  width: 172px; height: 172px;
  align-self: center;
}
#minimap {
  width: 172px; height: 172px;
  border: 2px solid var(--edge); border-radius: 8px;
  background: #000; cursor: pointer;
}
#idlebtn {
  position: absolute; left: -6px; top: -14px;
  background: #2b2318; border: 1px solid var(--gold); border-radius: 14px;
  font-size: 12px; padding: 2px 9px;
  cursor: pointer; display: none; align-items: center;
  z-index: 2;
}
#idlebtn:hover { background: #4a3b22; }

/* ---------------- tooltip ---------------- */
#tooltip {
  position: fixed; z-index: 30; display: none;
  max-width: 250px;
  background: rgba(16,13,8,.96);
  border: 1px solid var(--gold); border-radius: 8px;
  padding: 8px 11px;
  font-size: 12px; line-height: 1.5;
  pointer-events: none;
  box-shadow: 0 4px 18px rgba(0,0,0,.6);
}

/* ---------------- menus ---------------- */
#menu {
  position: fixed; inset: 0; z-index: 40;
  display: none; align-items: center; justify-content: center;
  background: rgba(8,6,3,.72);
  backdrop-filter: blur(5px);
}
#menu .panel {
  background: linear-gradient(180deg, #2e2617 0%, #191408 100%);
  border: 2px solid var(--edge); border-radius: 18px;
  padding: 38px 48px;
  text-align: center;
  max-width: 660px; max-height: 88vh; overflow-y: auto;
  box-shadow: 0 12px 60px rgba(0,0,0,.8);
}
#menu h1 {
  font-family: Georgia, serif; font-size: 34px; color: var(--gold);
  letter-spacing: .05em; margin-bottom: 14px;
}
#menu h1.vic { color: #7ede82; }
#menu h1.def { color: #ff6c5c; }
#menu .logo { font-size: 54px; }
#menu .title {
  font-family: Georgia, serif; font-size: 58px; font-weight: 800;
  letter-spacing: .28em; color: var(--gold); margin: 4px 0 0;
  text-shadow: 0 0 34px rgba(232,195,74,.4);
}
#menu .subtitle {
  font-family: Georgia, serif; font-size: 16px; letter-spacing: .34em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 18px;
}
#menu .intro { color: var(--ink); font-size: 14px; line-height: 1.7; margin-bottom: 20px; }
.diffrow { display: flex; gap: 10px; justify-content: center; margin-bottom: 22px; }
.diffopt input { display: none; }
.diffopt span {
  display: inline-block; padding: 8px 22px;
  border: 1px solid var(--edge); border-radius: 20px;
  color: var(--muted); cursor: pointer; font-size: 14px;
}
.diffopt input:checked + span {
  color: #1a1408; background: var(--gold); border-color: var(--gold); font-weight: 700;
}
.mbtn {
  display: block; margin: 10px auto 0;
  font: inherit; font-size: 16px; font-weight: 700;
  color: #1a1408;
  background: linear-gradient(180deg, #f2d264, #cf9f2e);
  border: none; border-radius: 10px;
  padding: 11px 34px; cursor: pointer;
  min-width: 240px;
}
.mbtn.big { font-size: 18px; padding: 14px 40px; }
.mbtn:hover { filter: brightness(1.1); }
.mbtn.ghostb {
  background: transparent; color: var(--muted);
  border: 1px solid var(--edge);
}
.mbtn.ghostb:hover { color: var(--ink); border-color: var(--muted); filter: none; }

.helpcols { display: flex; gap: 30px; text-align: left; margin-bottom: 10px; }
.helpcols > div { flex: 1; }
.helpcols h3 { color: var(--gold); font-size: 14px; margin: 12px 0 4px; font-family: Georgia, serif; }
.helpcols p { font-size: 12.5px; color: var(--ink); line-height: 1.6; }
table.keys { font-size: 12px; border-collapse: collapse; width: 100%; }
table.keys td { padding: 2.5px 6px; border-bottom: 1px solid rgba(255,255,255,.06); }
table.keys td:first-child { color: var(--gold); white-space: nowrap; font-weight: 600; }

table.stats { margin: 0 auto 8px; border-collapse: collapse; font-size: 14px; }
table.stats th, table.stats td { padding: 5px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
table.stats td:first-child { text-align: left; color: var(--muted); }
table.stats th { color: var(--gold); }

/* scrollbars */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: #4a3b22; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
