:root {
  --bg: #05060c;
  --panel: rgba(12, 9, 22, .86);
  --panel-2: rgba(30, 22, 48, .72);
  --line: rgba(159, 245, 214, .2);
  --mint: #9ff5d6;
  --mint-d: #4fc7a3;
  --vio: #c09bff;
  --mag: #ff7ad9;
  --ember: #ff8a4a;
  --gold: #ffd27a;
  --text: #ece9f7;
  --muted: #9d96b8;
  --bad: #ff7b7b;
  --good: #86f0b0;
  --cut: 10px;
  --disp: 'Unbounded', 'Segoe UI', system-ui, sans-serif;
  --body: 'Sora', 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 14px; user-select: none; -webkit-user-select: none; }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#gl { touch-action: none; cursor: grab; }
#gl:active { cursor: grabbing; }
body.aiming #gl { cursor: crosshair; }
#overlay { pointer-events: none; }
.hidden { display: none !important; }
button { font-family: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.ic { width: 100%; height: 100%; display: block; }
.cut {
  background: var(--panel);
  border: 1px solid var(--line);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  backdrop-filter: blur(6px);
}

/* ── Gombok ── */
.btn {
  padding: 13px 26px; font-weight: 600; letter-spacing: .02em; font-size: 14px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  transition: background .15s, transform .1s, color .15s;
}
.btn:hover { background: rgba(70, 52, 104, .85); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: linear-gradient(120deg, #5fe0b5, #9ff5d6); color: #07150f; border-color: transparent; font-weight: 700; }
.btn-primary:hover { background: linear-gradient(120deg, #79ecc5, #c2fbe6); }
.btn-primary:disabled { background: var(--panel-2); color: var(--muted); }
.btn-danger { background: rgba(120, 30, 40, .75); border-color: rgba(255, 123, 123, .4); }
.btn-danger:hover { background: rgba(160, 40, 50, .85); }

/* ── Címkép ── */
.screen { position: fixed; inset: 0; pointer-events: none; }
#title { display: flex; align-items: center; padding: 0 7vw; }
.title-inner { max-width: 620px; pointer-events: auto; margin-top: 30vh; }
.kicker { color: var(--mint); letter-spacing: .24em; font-size: 12px; text-transform: uppercase; margin-bottom: 14px; }
h1 { font-family: var(--disp); font-weight: 800; font-size: clamp(38px, 6.2vw, 84px); line-height: .98; margin: 0 0 18px; letter-spacing: -.01em;
  background: linear-gradient(100deg, #f4fff9 10%, var(--mint) 55%, var(--vio) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 26px rgba(120, 240, 200, .32)); }
h1 em { display: block; font-style: normal; font-weight: 500; font-size: .42em; letter-spacing: .5em; margin-top: 8px; }
.story { color: #d4d0e6; line-height: 1.65; font-size: 15px; margin: 0 0 10px; font-weight: 300; text-shadow: 0 1px 8px #000; }
.story.strong { color: var(--text); font-weight: 600; }
.actions { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }

/* ── Nyelvválasztó ── */
.lang-switch { display: inline-flex; gap: 2px; padding: 3px; pointer-events: auto; background: var(--panel); border: 1px solid var(--line); }
.screen > .lang-switch { position: absolute; top: 14px; left: 14px; z-index: 5; }
.lang-btn { padding: 5px 10px; font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--muted); }
.lang-btn:hover { color: var(--text); }
.lang-btn.on { background: var(--mint); color: #07150f; cursor: default; }
.lang-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0; font-size: 13px; color: var(--muted); }

/* ── Leszállóhely ── */
#sites { display: flex; justify-content: flex-end; }
#site-panel { width: 380px; margin: 16px; display: flex; flex-direction: column; pointer-events: auto; max-height: calc(100vh - 32px); }
.site-top { padding: 18px 18px 8px; }
.site-top h2 { font-family: var(--disp); font-weight: 500; font-size: 19px; margin: 0 0 6px; color: var(--mint); }
.site-top p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
#site-gen { color: var(--gold); font-size: 12px; margin-top: 6px; }
#site-gen:empty { display: none; }
#site-list { flex: 1; overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 7px; scrollbar-width: thin; scrollbar-color: #3b2f5c transparent; }
.site { text-align: left; padding: 10px 12px; background: var(--panel-2); border: 1px solid transparent; border-left: 3px solid var(--c); display: flex; flex-direction: column; gap: 4px; transition: background .15s, border-color .15s; flex: none; }
.site:hover { background: rgba(62, 46, 92, .8); }
.site.on { background: rgba(70, 52, 104, .92); border-color: var(--c); }
.site-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.site-name { font-weight: 600; font-size: 13.5px; }
.diff { display: inline-flex; gap: 2px; flex: none; }
.diff i { width: 9px; height: 9px; background: var(--c); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.diff i.off { background: rgba(255, 255, 255, .13); }
.site-tag { color: var(--muted); font-size: 12px; line-height: 1.4; }
.site-detail { display: none; flex-direction: column; gap: 6px; margin-top: 5px; font-size: 12px; line-height: 1.4; }
.site.on .site-detail, .site:hover .site-detail { display: flex; }
.pros, .cons { display: flex; flex-direction: column; gap: 2px; }
.pros span { color: var(--good); }
.cons span { color: #ff9c9c; }
.pros span::before { content: '▲ '; font-size: 9px; }
.cons span::before { content: '▼ '; font-size: 9px; }
.site-actions { display: flex; gap: 8px; padding: 12px; }
.site-actions #btn-land { flex: 1; }
.site-actions #btn-reroll { padding: 13px 14px; font-size: 13px; }

/* ── HUD ── */
#hud { position: fixed; inset: 0; pointer-events: none; }
#left-col { position: absolute; top: 12px; left: 12px; right: 396px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
#top { width: 100%; display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
#top > * { pointer-events: auto; }
#energy-box { padding: 10px 18px 10px 14px; min-width: 214px; }
.energy-main { display: flex; align-items: center; gap: 8px; font-family: var(--disp); font-weight: 800; font-size: 25px; color: var(--mint); text-shadow: 0 0 16px rgba(120, 240, 200, .45); white-space: nowrap; }
.energy-ic { width: 22px; height: 22px; color: var(--gold); flex: none; }
.energy-sub { display: flex; justify-content: space-between; gap: 14px; margin-top: 3px; font-size: 12px; white-space: nowrap; }
.label { color: var(--muted); }
#income { color: var(--good); font-weight: 600; font-variant-numeric: tabular-nums; }
#world-box, #alert-box { padding: 10px 14px; min-width: 232px; flex: 0 1 280px; }
.world-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 12.5px; }
.world-row b { font-family: var(--disp); font-weight: 500; font-size: 14px; color: var(--text); white-space: nowrap; }
.world-row.small { color: var(--muted); font-size: 11px; margin-top: 5px; white-space: nowrap; }
.bar { height: 7px; background: rgba(255, 255, 255, .08); margin-top: 6px; clip-path: polygon(3px 0, 100% 0, calc(100% - 3px) 100%, 0 100%); }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--mint-d), var(--mint), var(--vio)); transition: width .25s; }
.bar-alert i { background: linear-gradient(90deg, #ffd27a, #ff8a4a, #ff4d4d); }
#alert-box b { color: var(--gold); font-size: 12px; }
#alert-box.s1 b { color: var(--ember); }
#alert-box.s2 b { color: var(--bad); }

#hosts { width: 268px; padding: 8px; pointer-events: auto; display: flex; flex-direction: column; gap: 3px; }
.host { display: flex; align-items: center; gap: 9px; padding: 5px 7px; }
.host-ic { width: 22px; height: 22px; color: var(--c); flex: none; filter: drop-shadow(0 0 5px color-mix(in srgb, var(--c) 50%, transparent)); }
.host-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.host-name { font-weight: 600; font-size: 12.5px; }
.host-sub { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.host-rate { font-size: 11.5px; font-weight: 600; color: var(--c); white-space: nowrap; font-variant-numeric: tabular-nums; }
.host.locked { opacity: .5; }
.host.locked .host-ic { filter: grayscale(1); }

#log { position: absolute; left: 12px; bottom: 66px; width: min(470px, calc(100vw - 420px)); display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
.line { font-size: 12.5px; line-height: 1.4; padding: 5px 10px; background: rgba(8, 6, 16, .62); border-left: 2px solid var(--mint-d); color: #dcd8ee; animation: rise .4s ease-out; transition: opacity 1.4s; }
.line.news { border-left-color: var(--gold); color: #f4e7c8; }
.line.bad { border-left-color: var(--bad); color: #ffc9c9; }
.line.hint { border-left-color: var(--vio); color: #d9c8ff; }
.line.fade { opacity: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

#tools { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 6px; pointer-events: auto; }
.tool { width: 42px; height: 42px; padding: 11px; background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px); transition: color .15s, background .15s; }
.tool:hover { color: var(--text); background: rgba(50, 38, 76, .9); }
.tool.on { color: var(--mint); }
.tool.wide { width: auto; display: flex; align-items: center; gap: 8px; padding: 0 16px 0 12px; font-weight: 600; font-size: 13px; color: var(--mint); }
.tool.wide span { width: 20px; height: 20px; display: block; }
.tool.wide.on { background: linear-gradient(120deg, #5fe0b5, #9ff5d6); color: #07150f; }

/* ── Fejlesztések ── */
#panel { position: absolute; top: 12px; right: 12px; bottom: 12px; width: 370px; display: flex; flex-direction: column; pointer-events: auto; transition: transform .22s ease; }
#panel.closed { transform: translateX(calc(100% + 16px)); }
#panel-toggle { position: absolute; top: calc(50% - 26px); right: 382px; width: 18px; height: 52px; padding: 2px; pointer-events: auto; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-right: 0; clip-path: polygon(0 8px, 100% 0, 100% 100%, 0 calc(100% - 8px)); transition: right .22s ease, color .15s; }
#panel-toggle:hover { color: var(--mint); }
#panel-toggle.closed { right: 0; }
#tabs { display: flex; padding: 8px 8px 0; gap: 2px; border-bottom: 1px solid var(--line); flex: none; }
.tab { flex: 1; padding: 8px 2px 9px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: var(--muted); position: relative; border-bottom: 2px solid transparent; transition: color .15s; }
.tab .ic { width: 20px; height: 20px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--mint); border-bottom-color: var(--mint); }
.badge { position: absolute; top: 2px; right: 7px; min-width: 15px; height: 15px; line-height: 15px; font-size: 9.5px; font-style: normal; font-weight: 700; text-align: center; background: var(--mint); color: #07150f; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); padding: 0 2px; display: none; }
.badge.on { display: block; }
#upg-list { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; scrollbar-width: thin; scrollbar-color: #3b2f5c transparent; }
.upg { display: none; width: 100%; flex: none; text-align: left; align-items: center; gap: 10px; padding: 9px 11px; background: var(--panel-2); border: 1px solid transparent; transition: background .12s, border-color .12s, opacity .15s; }
.upg.show { display: flex; }
.upg:hover { background: rgba(58, 44, 86, .85); }
.upg-ic { width: 30px; height: 30px; flex: none; color: var(--muted); }
.upg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.upg-head { display: flex; align-items: baseline; gap: 7px; }
.upg-name { font-weight: 600; font-size: 13px; }
.upg-lvl { font-style: normal; font-size: 10.5px; color: var(--muted); }
.upg-desc { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.upg-eff { font-size: 11.5px; color: var(--vio); line-height: 1.3; }
.upg-cost { flex: none; font-family: var(--disp); font-weight: 500; font-size: 12px; color: var(--muted); white-space: nowrap; }
.upg.afford { border-color: rgba(159, 245, 214, .5); }
.upg.afford .upg-ic { color: var(--mint); filter: drop-shadow(0 0 6px rgba(120, 240, 200, .55)); }
.upg.afford .upg-cost { color: var(--mint); }
.upg.locked { opacity: .5; cursor: default; }
.upg.locked .upg-eff { color: var(--ember); }
.upg.maxed { opacity: .62; cursor: default; }
.upg.maxed .upg-eff { color: var(--good); }

/* ── Súgó és ablak ── */
#tooltip { position: fixed; left: 0; top: 0; max-width: 270px; padding: 8px 11px; background: rgba(10, 7, 20, .94); border: 1px solid var(--line); pointer-events: none; display: flex; flex-direction: column; gap: 2px; font-size: 12px; line-height: 1.4; z-index: 30; }
#tooltip b { font-size: 13px; color: var(--text); }
#tooltip span { color: #c6c1da; }
#tooltip em { font-style: normal; color: var(--mint); font-size: 11.5px; }
#tooltip .ok { color: var(--good); }
#tooltip .bad { color: var(--bad); }
#tooltip .vio { color: var(--vio); }
#modal { position: fixed; inset: 0; background: rgba(3, 2, 8, .62); display: flex; align-items: center; justify-content: center; z-index: 40; padding: 16px; }
#modal-card { width: min(500px, 100%); padding: 24px; max-height: 90vh; overflow-y: auto; }
#modal-card h2 { font-family: var(--disp); font-weight: 500; font-size: 20px; margin: 0 0 12px; color: var(--mint); }
.modal-body { line-height: 1.6; font-size: 13.5px; color: #d7d3e8; }
.modal-body p { margin: 0 0 12px; }
.stats { display: flex; flex-direction: column; gap: 1px; margin: 10px 0 14px; }
.stat { display: flex; justify-content: space-between; gap: 12px; padding: 6px 10px; background: var(--panel-2); font-size: 13px; }
.stat span { color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.modal-actions .btn { padding: 11px 18px; font-size: 13px; }
#fatal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 30px; background: #05060c; z-index: 50; }
#fatal h2 { font-family: var(--disp); color: var(--mint); }

/* ── Keskeny kijelző ── */
@media (max-width: 820px) {
  #left-col { right: 8px; top: 8px; left: 8px; }
  #top { gap: 6px; width: 100%; }
  #energy-box { min-width: 0; flex: 1 1 100%; padding: 8px 12px; }
  .energy-main { font-size: 20px; }
  #world-box, #alert-box { flex: 1 1 40%; min-width: 0; padding: 7px 10px; }
  .world-row.small { white-space: normal; }
  #hosts { display: none; }
  #log { width: calc(100vw - 24px); bottom: 62px; left: 12px; }
  .line { font-size: 11.5px; padding: 3px 8px; }
  #panel { top: auto; left: 8px; right: 8px; bottom: 60px; width: auto; height: 52vh; }
  #panel.closed { transform: translateY(calc(100% + 70px)); }
  #panel-toggle, #panel-toggle.closed { position: absolute; right: 12px; bottom: 12px; top: auto; width: 42px; height: 42px; padding: 11px; background: var(--panel); border: 1px solid var(--line); color: var(--mint); clip-path: none; }
  #tools { left: 8px; bottom: 10px; }
  .tool { width: 38px; height: 38px; padding: 9px; }
  #site-panel { width: auto; flex: 1; margin: 8px; position: fixed; left: 0; right: 0; bottom: 0; max-height: 58vh; }
  .title-inner { margin-top: 18vh; }
}

/* ── Kampánytérkép ── */
#map { display: flex; justify-content: flex-end; }
#map-panel { width: 420px; margin: 12px; display: flex; flex-direction: column; pointer-events: auto; max-height: calc(100vh - 24px); }
#map-tabs { display: flex; padding: 8px 8px 0; gap: 2px; border-bottom: 1px solid var(--line); flex: none; }
#map-body { flex: 1; overflow-y: auto; padding: 12px; scrollbar-width: thin; scrollbar-color: #3b2f5c transparent; }
.rg-card { padding: 14px; background: var(--panel-2); border-left: 3px solid var(--c); margin-bottom: 8px; }
.rg-card h2 { font-family: var(--disp); font-weight: 500; font-size: 18px; margin: 0; color: var(--c); }
.rg-card p { margin: 8px 0 0; font-size: 12.5px; line-height: 1.5; color: #d7d3e8; }
.rg-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rg-stars { color: var(--gold); white-space: nowrap; letter-spacing: 1px; }
.rg-tier { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.diffs { color: var(--c); letter-spacing: 1px; }
.diffs .off { color: rgba(255, 255, 255, .14); }
.rg-teach { color: var(--vio) !important; }
.rg-goals { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.rg-goals.dim { color: var(--muted); font-size: 11.5px; }
.rg-goals:not(.dim) span::before { content: '◆ '; color: var(--c, var(--mint)); font-size: 10px; }
.rg-reward { font-size: 11.5px; color: var(--gold); margin: 10px 0; }
.rg-card .btn { width: 100%; }
.sec-title { font-weight: 600; font-size: 12px; color: var(--mint); margin: 12px 0 6px; letter-spacing: .02em; }
.sec-title small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.sec-title.big { font-size: 14px; margin-top: 2px; }
.sec-title.big b { font-family: var(--disp); font-size: 22px; color: var(--gold); }
.rg-list { display: flex; flex-direction: column; gap: 3px; }
.rg-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; font-size: 12.5px; text-align: left; background: rgba(30, 22, 48, .45); border-left: 3px solid var(--c); }
.rg-row:hover { background: rgba(62, 46, 92, .8); }
.rg-row.on { background: rgba(70, 52, 104, .92); }
.rg-row em { font-style: normal; color: var(--gold); white-space: nowrap; }
.rg-row.locked { opacity: .42; border-left-color: #555; cursor: default; }
.daily { width: 100%; text-align: left; padding: 10px 12px; background: var(--panel-2); border: 1px solid rgba(255, 210, 122, .35); display: flex; flex-direction: column; gap: 3px; }
.daily:hover { background: rgba(62, 46, 92, .8); }
.daily b { color: var(--gold); font-size: 13px; }
.daily span { font-size: 12px; color: var(--muted); line-height: 1.4; }
.daily em { font-style: normal; font-size: 11.5px; color: var(--mint); }
.perk-grid { display: flex; flex-direction: column; gap: 5px; }
.perk { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; text-align: left; background: var(--panel-2); border: 1px solid transparent; }
.perk:hover { background: rgba(58, 44, 86, .85); }
.perk-ic { width: 26px; height: 26px; flex: none; color: var(--muted); }
.perk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.perk-main b { font-size: 12.5px; }
.perk-main small { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.perk em { font-style: normal; font-family: var(--disp); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.perk.can { border-color: rgba(159, 245, 214, .4); }
.perk.can .perk-ic, .perk.can em { color: var(--mint); }
.perk.own { opacity: .7; cursor: default; }
.perk.own .perk-ic, .perk.own em { color: var(--good); }
.memories { display: flex; flex-direction: column; gap: 6px; }
.memory { margin: 0 0 8px; padding: 8px 12px; font-size: 13px; line-height: 1.55; font-weight: 300; color: #e4dff5; background: rgba(90, 60, 130, .18); border-left: 2px solid var(--vio); }
.memory.locked { color: var(--muted); font-style: italic; opacity: .55; }
.memory.big { font-size: 14.5px; }
.ach-list { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 12px; }
.ach { padding: 7px 9px; background: rgba(30, 22, 48, .5); display: grid; grid-template-columns: 18px 1fr; column-gap: 7px; opacity: .45; }
.ach span { width: 18px; height: 18px; color: var(--muted); grid-row: span 2; }
.ach b { font-size: 11.5px; }
.ach small { font-size: 10.5px; color: var(--muted); line-height: 1.3; }
.ach.on { opacity: 1; }
.ach.on span { color: var(--gold); }
.btn.small { padding: 8px 12px; font-size: 12px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { padding: 6px 10px; font-size: 12px; background: var(--panel-2); border: 1px solid transparent; transition: background .12s, border-color .12s; }
.chip:hover { background: rgba(62, 46, 92, .85); }
.chip.on { border-color: var(--mint); color: var(--mint); }

/* ── Leszállóhely kiegészítés ── */
#site-panel { width: 396px; }
#site-scroll { flex: 1; overflow-y: auto; padding: 0 12px 6px; scrollbar-width: thin; scrollbar-color: #3b2f5c transparent; }
#site-list { overflow: visible; padding: 0; }
#site-goals { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; font-size: 12.5px; color: var(--text); }
#site-goals span::before { content: '◆ '; color: var(--gold); font-size: 10px; }
.site-top { padding-bottom: 4px; }
.site-actions #btn-land { padding: 13px 10px; }
.site-actions .btn:not(#btn-land) { padding: 13px 11px; font-size: 12.5px; }
#branch-list { display: flex; flex-direction: column; gap: 5px; }
.branch { display: flex; gap: 10px; width: 100%; padding: 8px 10px; text-align: left; background: var(--panel-2); border: 1px solid transparent; border-left: 3px solid var(--c); }
.branch:hover { background: rgba(62, 46, 92, .85); }
.branch.on { background: rgba(70, 52, 104, .92); border-color: var(--c); }
.branch.static { cursor: default; margin-bottom: 4px; }
.br-ic { width: 26px; height: 26px; color: var(--c); flex: none; }
.br-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.br-main b { font-size: 13px; }
.br-main small { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.branch.on .site-detail, .branch:hover .site-detail { display: flex; }
#perk-list { display: flex; flex-wrap: wrap; gap: 5px; }

/* ── HUD új elemei ── */
#left-col { pointer-events: none; }
#top > * { flex: none; }
#energy-box { padding: 8px 14px 8px 12px; min-width: 200px; }
.energy-main { font-size: 22px; }
.energy-sub { font-size: 11px; flex-direction: column; gap: 0; margin-top: 2px; }
.dim { color: var(--muted); }
.neg { color: var(--bad) !important; }
.warn { color: var(--ember); font-size: 11.5px; font-weight: 600; animation: blink 1s infinite alternate; }
@keyframes blink { from { opacity: 1; } to { opacity: .5; } }
#res-box { padding: 8px 12px; display: flex; flex-direction: column; gap: 5px; justify-content: center; min-width: 158px; }
.res-row { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.res-row b { font-family: var(--disp); font-weight: 500; font-size: 13px; }
.res-row small { color: var(--muted); font-size: 10.5px; margin-left: auto; padding-left: 8px; }
.res-ic { width: 17px; height: 17px; flex: none; }
.res-ic.bio { color: #b6e07b; }
.res-ic.spo { color: #d59bff; }
#home-box { padding: 8px 12px; min-width: 150px; flex: 0 0 170px; }
#home-box.danger { border-color: var(--bad); }
#home-box.danger b { color: var(--bad); }
.bar-home i { background: linear-gradient(90deg, #ff8a4a, #ffd27a, #9ff5d6); }
.bar-order i { background: linear-gradient(90deg, #ff6b6b, #8fd3ff); }
.bar-tech i { background: linear-gradient(90deg, #8fd3ff, #c09bff); }
.warnt { color: var(--ember); }
#env-box { padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; justify-content: center; font-size: 12px; min-width: 104px; }
.env-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.env-ic { width: 15px; height: 15px; flex: none; color: var(--gold); }
#time-box { padding: 6px 8px; display: flex; gap: 2px; align-items: center; }
.tb { width: 32px; height: 32px; padding: 7px; color: var(--muted); background: transparent; transition: color .12s, background .12s; }
.tb.txt { padding: 0; font-size: 12px; font-weight: 600; }
.tb:hover { color: var(--text); background: rgba(62, 46, 92, .8); }
.tb.on { color: #07150f; background: var(--mint); }
#side { width: 268px; display: flex; flex-direction: column; gap: 8px; }
#side > * { pointer-events: auto; }
#goal-box, #alert-box, #res-tech { padding: 8px 12px; min-width: 0; flex: none; }
.box-head { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; margin-bottom: 5px; }
#run-time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
#run-time.late { color: var(--ember); }
.goal { font-size: 12px; line-height: 1.35; margin-bottom: 5px; }
.goal:last-child { margin-bottom: 0; }
.goal .bar { margin-top: 3px; height: 5px; }
.goal.done { color: var(--good); }
.goal.done span::before { content: '✓ '; }
.goal.rival { color: #ffb35c; }
#alert-box .world-row { margin-top: 3px; }
#alert-box b { color: var(--text); font-size: 13px; }
#alert-box .bar { margin-top: 3px; height: 5px; }
.tech-name { font-size: 11.5px; margin-top: 3px; color: #c6d6ff; line-height: 1.35; }
.tech-done { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 5px; }
.tech-done:empty { display: none; }
.tech-done span { font-size: 9.5px; padding: 1px 5px; background: rgba(255, 255, 255, .08); color: var(--muted); }
#res-tech b { font-size: 11px; color: #8fd3ff; }
#res-tech.final { border-color: var(--bad); }
#res-tech.final .tech-name { color: #ffb3b3; font-weight: 600; }
#res-tech.final .bar i { background: linear-gradient(90deg, #ff8a4a, #ff4d4d); }
#threat-list { display: flex; flex-direction: column; gap: 3px; }
#threat-list.flash .threat { animation: tflash .5s ease-out; }
@keyframes tflash { from { background: rgba(255, 90, 70, .75); } to { background: rgba(30, 10, 14, .82); } }
.threat { display: flex; align-items: center; gap: 8px; padding: 4px 9px; font-size: 11.5px; background: rgba(30, 10, 14, .82); border-left: 3px solid var(--ember); cursor: pointer; }
.threat:hover { background: rgba(60, 20, 26, .9); }
.threat b { font-family: var(--disp); font-weight: 500; font-size: 13px; min-width: 22px; color: #ffb9a1; }
.threat.missile { border-left-color: #ff3b3b; background: rgba(70, 8, 12, .92); }
.threat.flood { border-left-color: #6fd3e8; }
.threat.break { border-left-color: var(--gold); }

#log { left: 290px; bottom: 76px; width: min(440px, calc(100vw - 700px)); }
.line.vera { border-left-color: #8fd3ff; color: #cfe6ff; font-style: italic; }
.line.good { border-left-color: var(--good); color: #c9f7d8; }
.line.story { border-left-color: var(--mint-d); }

#bottom { position: absolute; left: 12px; right: 396px; bottom: 12px; display: flex; align-items: flex-end; gap: 12px; pointer-events: none; }
#tools { position: static; flex: none; flex-wrap: wrap; width: 142px; }
.tool { width: 42px; height: 42px; }
#toolbar { display: flex; flex-wrap: wrap; gap: 4px; pointer-events: auto; margin: 0 auto; justify-content: center; }
.bbtn { position: relative; width: 56px; height: 62px; padding: 6px 4px 3px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; overflow: hidden; clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px); transition: background .12s, color .12s; }
.bbtn:hover { background: rgba(50, 38, 76, .95); }
.bb-ic { width: 24px; height: 24px; flex: none; }
.bb-key { position: absolute; top: 2px; right: 5px; font-size: 9.5px; color: var(--muted); }
.bb-cost { font-size: 10px; white-space: nowrap; line-height: 1.2; margin-top: auto; padding-bottom: 2px; }
.bb-cd { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(4, 3, 10, .72); pointer-events: none; }
.bbtn.g-build.can { color: #b6e07b; }
.bbtn.g-abil.can { color: #d59bff; }
.bbtn.g-spore { color: var(--mint); }
.bbtn.on { background: linear-gradient(120deg, #5fe0b5, #9ff5d6); color: #07150f !important; }
.bbtn.on .bb-key { color: #07150f; }
.bbtn.g-abil:first-of-type { margin-left: 8px; }
#mode-hint { position: absolute; left: 50%; bottom: 84px; transform: translateX(calc(-50% - 186px)); padding: 6px 14px; background: rgba(8, 6, 16, .86); border: 1px solid var(--mint-d); font-size: 12.5px; color: var(--mint); white-space: nowrap; }
#pause-tag { position: absolute; left: calc(50% - 186px); top: 92px; transform: translateX(-50%); font-family: var(--disp); font-size: 20px; letter-spacing: .3em; color: var(--mint); text-shadow: 0 0 18px rgba(120, 240, 200, .7); pointer-events: none; }
#bar-tip { position: fixed; left: 0; top: 0; max-width: 290px; padding: 8px 11px; background: rgba(10, 7, 20, .96); border: 1px solid var(--line); pointer-events: none; display: flex; flex-direction: column; gap: 4px; font-size: 12px; line-height: 1.4; z-index: 30; }
#bar-tip b { font-size: 13px; color: var(--mint); }
#bar-tip span { color: #c6c1da; }
#bar-tip .dim { color: var(--muted); font-size: 11.5px; }
#tooltip .warn { color: var(--ember); font-size: inherit; animation: none; font-weight: 400; }

/* ── Anyagcsere-doboz ── */
#meta-box { flex: none; padding: 0 2px 6px; }
#meta-box .sec-title:first-child { margin-top: 2px; }
.alloc-row { display: block; margin-bottom: 8px; }
.alloc-head { display: flex; justify-content: space-between; font-size: 12.5px; }
.alloc-head b { color: var(--c); font-weight: 600; }
.alloc-head em { font-style: normal; color: var(--text); font-variant-numeric: tabular-nums; }
.alloc-row input { width: 100%; margin: 2px 0 0; accent-color: var(--c); height: 18px; cursor: pointer; }
.alloc-row small { display: block; font-size: 10.5px; color: var(--muted); line-height: 1.3; }
#presets { display: flex; flex-wrap: wrap; gap: 4px; }
#presets .chip { padding: 5px 8px; font-size: 11px; }
#hosts { width: auto; padding: 0; background: none; border: 0; clip-path: none; backdrop-filter: none; pointer-events: auto; }
.sum-row { display: flex; justify-content: space-between; padding: 3px 7px; font-size: 12px; color: var(--muted); }
.sum-row b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
#ag-box { flex: none; }

/* ── Település-panel ── */
#town { position: absolute; left: 292px; top: 96px; width: 320px; max-height: calc(100vh - 190px); overflow-y: auto; padding: 12px 14px; pointer-events: auto; scrollbar-width: thin; }
.town-head { display: flex; justify-content: space-between; align-items: center; }
.town-head h3 { margin: 0; font-family: var(--disp); font-weight: 500; font-size: 16px; color: var(--mint); }
.tclose { padding: 2px 6px; color: var(--muted); }
.tclose:hover { color: var(--text); }
.town-kind { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.stats.compact { margin: 4px 0 8px; }
.stats.compact .stat { padding: 4px 8px; font-size: 12px; }
.tag { font-size: 10.5px; padding: 2px 7px; background: rgba(255, 255, 255, .09); color: var(--text); }
.tag.warn { background: rgba(255, 210, 122, .2); color: var(--gold); animation: none; font-weight: 400; }
.tag.bad { background: rgba(255, 123, 123, .2); color: #ffb3b3; }
.tag.info { background: rgba(143, 211, 255, .18); color: #bfe5ff; }
.order { display: flex; gap: 9px; width: 100%; padding: 7px 9px; text-align: left; background: var(--panel-2); border: 1px solid transparent; margin-bottom: 4px; }
.order:hover { background: rgba(62, 46, 92, .85); }
.order.on { border-color: var(--mint); }
.order-ic { width: 22px; height: 22px; flex: none; color: var(--muted); }
.order.on .order-ic { color: var(--mint); }
.order b { display: block; font-size: 12.5px; }
.order small { display: block; font-size: 11px; color: var(--muted); line-height: 1.35; }
.town-acts { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; }

/* ── Jelzések és eredmény ── */
#toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 35; pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: center; padding: 8px 16px; font-size: 13px; color: var(--gold); transition: opacity .8s; animation: rise .4s ease-out; }
.toast span { width: 22px; height: 22px; flex: none; }
.toast.fade { opacity: 0; }
.big-stars { font-size: 34px; color: var(--gold); text-align: center; letter-spacing: 6px; margin-bottom: 6px; text-shadow: 0 0 18px rgba(255, 210, 122, .5); }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 8px 0; cursor: pointer; }
.toggle input { accent-color: var(--mint); }

/* ── Kisebb ablakok ── */
@media (max-width: 1320px) {
  #env-box { min-width: 0; }
  .bbtn { width: 50px; }
  #log { width: min(400px, calc(100vw - 690px)); }
}
@media (max-width: 1120px) {
  #log { display: none; }
  #town { left: 12px; top: auto; bottom: 90px; }
}
@media (max-width: 820px) {
  #map-panel { width: auto; flex: 1; margin: 8px; position: fixed; left: 0; right: 0; bottom: 0; max-height: 50vh; }
  #site-panel { width: auto; }
  #left-col { position: absolute; }
  #side { width: 200px; }
  #res-tech, #env-box, #home-box .small { display: none; }
  #energy-box { flex: 0 1 auto; min-width: 0; }
  #bottom { left: 8px; right: 60px; bottom: 8px; flex-direction: column; align-items: flex-start; gap: 4px; }
  #tools { width: auto; flex-wrap: nowrap; }
  #toolbar { margin: 0; justify-content: flex-start; }
  .bbtn { width: 42px; height: 50px; padding-top: 3px; }
  .bb-ic { width: 18px; height: 18px; }
  .bb-cost { font-size: 9px; }
  #log { display: flex; left: 8px; right: 8px; width: auto; bottom: 150px; }
  #mode-hint { left: 8px; right: 8px; transform: none; bottom: 150px; white-space: normal; font-size: 11.5px; }
  #pause-tag { left: 50%; }
  #town { left: 8px; right: 8px; width: auto; top: auto; bottom: 150px; max-height: 45vh; }
  .ach-list { grid-template-columns: 1fr; }
}

/* ── Csapáslista: mi forog kockán, és egy kattintásos kitérés ── */
.threat { padding: 3px 5px 3px 9px; }
.threat .t-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.threat small { font-size: 10px; color: #dcb7ab; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.threat.big { border-left-color: #ff4d4d; background: rgba(78, 14, 16, .92); }
.threat.big small { color: #ffc4b8; font-weight: 600; }
.threat.sampler { border-left-color: #8fd3ff; background: rgba(12, 30, 52, .9); }
.threat.sampler b { color: #bfe5ff; }
.threat.sampler small { color: #a8cbe6; }
.t-dive { width: 26px; height: 26px; padding: 5px; flex: none; color: rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .05); clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px); }
.t-dive.on { color: #07150f; background: var(--mint); }
.t-dive.on:hover { background: #c2fbe6; }
.t-dive.safe { color: #8df7ff; background: rgba(120, 220, 255, .16); }

/* ── Energiaparancsok az eszköztáron ── */
.bbtn.g-cmd { color: var(--muted); }
.bbtn.g-cmd.can { color: var(--gold); }
.bbtn.active { background: linear-gradient(120deg, #ffd27a, #ffb45c); color: #1c1204 !important; }
.bbtn.active .bb-key { color: #1c1204; }
.bbtn.g-cmd:first-of-type { margin-left: 8px; }
@media (max-width: 1500px) {
  .bbtn { width: 48px; padding-left: 2px; padding-right: 2px; }
  .bb-cost { font-size: 9.5px; }
}
@media (max-width: 1320px) {
  .bbtn { width: 44px; }
  #toolbar { gap: 3px; }
}

/* ── Önjárás ── */
#auto-box { flex: none; padding: 0 2px 2px; }
#auto-box .sec-title:first-child { margin-top: 2px; }
#auto-box .toggle { font-size: 12px; margin: 4px 0; line-height: 1.35; align-items: flex-start; }
#auto-box .toggle input { margin-top: 2px; }
#auto-box .hint { margin: 0; font-size: 11.5px; line-height: 1.45; }
.upg.switch { opacity: 1; cursor: pointer; border-color: rgba(159, 245, 214, .45); }
.upg.switch .upg-cost { color: #07150f; background: var(--mint); padding: 3px 9px; font-size: 11px; clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px); }
.upg.switch .upg-eff { color: var(--good); }
.upg.switch .upg-ic { color: var(--mint); }
.upg.switch.off { border-color: transparent; }
.upg.switch.off .upg-cost { color: var(--muted); background: rgba(255, 255, 255, .1); }
.upg.switch.off .upg-eff { color: var(--muted); }
.upg.switch.off .upg-ic { color: var(--muted); }
.tab span { white-space: nowrap; }

/* ── Bolygóhálózat a térképen ── */
.perk-main .lv { font-style: normal; font-weight: 400; font-size: 10.5px; color: var(--muted); margin-left: 4px; }
.perk-main .eff { color: var(--vio); }
#map-tabs .tab { font-size: 10px; }
