:root {
  --bg: #14150f;
  --panel: #1c1e17;
  --line: #333527;
  --text: #e8ebd9;
  --dim: #b3ba9c;
  --accent: #b2e07a;
  --warn: #d98f4a;
  --danger: #c25a4a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

#topbar {
  display: flex;
  align-items: flex-end;
  gap: 24px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
  flex-wrap: wrap;
}

.counter-label { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
#eh { font-size: 30px; font-weight: 700; line-height: 1.1; }
#counter .sub { color: var(--dim); }

#topStats { display: flex; gap: 18px; flex-wrap: wrap; padding-bottom: 4px; }
#topStats b { color: var(--accent); font-weight: 600; }
.pulse { animation: landPulse 0.7s ease-out; }
@keyframes landPulse {
  0% { color: #fff; }
  100% { color: var(--accent); }
}

#board {
  display: grid;
  grid-template-columns: repeat(4, minmax(210px, 1fr));
  gap: 14px;
  padding: 16px 18px 60px;
  align-items: start;
}

.col { display: flex; flex-direction: column; gap: 14px; }
.col.wide { grid-column: span 1; }

.desk {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 10px 12px 12px;
}

.desk h2 {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--dim);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}

hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }

.row { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; align-items: center; }
.row b { color: var(--text); }

.note { color: var(--dim); font-size: 12px; margin-top: 6px; }

button {
  background: #262a1e;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 5px 9px;
  font: inherit;
  cursor: pointer;
}
button:hover:not(:disabled) { background: #303525; border-color: #4a4f38; }
button:disabled { opacity: .38; cursor: default; }
/* Same look as disabled, but the button still receives clicks so a price that
   changes mid-press cannot swallow the event. */
button.cant { opacity: .38; }
button.big { width: 100%; padding: 10px; font-size: 14px; margin-bottom: 8px; }
button.mini { padding: 1px 7px; }
button.small { font-size: 11px; padding: 3px 7px; }
button.danger { border-color: #5c332c; color: #e0a99f; }
button.danger:hover:not(:disabled) { background: #3a201b; }
button.ready { border-color: var(--accent); color: var(--accent); }

.btnrow { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.btnrow.right { justify-content: flex-end; margin-top: 14px; }

select { background: #262a1e; color: var(--text); border: 1px solid var(--line); font: inherit; padding: 4px; flex: 1; }

label.slider { display: block; margin: 6px 0; }
label.slider span { display: flex; justify-content: space-between; color: var(--dim); font-size: 12px; }
label.slider i { font-style: normal; color: var(--text); }
input[type=range] { width: 100%; accent-color: var(--accent); }

/* Shares are relative, so the split bar carries the percentages while each
   slider only reports its own weight. */
.split { display: flex; height: 10px; border: 1px solid var(--line); background: #101208; margin: 2px 0 4px; }
.split i { display: block; transition: width .15s linear; }
.split .segEstablish { background: var(--accent); }
.split .segEnrich { background: #6fb3d9; }
.split .segClimax { background: var(--warn); }
.legend { font-size: 12px; gap: 10px; }
.legend span { display: flex; align-items: center; gap: 5px; color: var(--dim); }
.legend em { width: 8px; height: 8px; display: inline-block; font-style: normal; }
.legend .segEstablish { background: var(--accent); }
.legend .segEnrich { background: #6fb3d9; }
.legend .segClimax { background: var(--warn); }

.meter { position: relative; height: 12px; background: #101208; border: 1px solid var(--line); overflow: hidden; }
.meter.hot { border-color: var(--accent); }
#grantFill { position: absolute; top: 0; bottom: 0; left: 0; width: 4px; background: var(--accent); opacity: .95; z-index: 2; }
#grantHot { position: absolute; top: 0; bottom: 0; background: var(--warn); opacity: .55; }

.item {
  border: 1px solid var(--line);
  padding: 7px 8px;
  margin-bottom: 6px;
  background: #1f2219;
}
.item .name { display: flex; justify-content: space-between; gap: 8px; }
.item .desc { color: var(--dim); font-size: 11px; margin: 3px 0 6px; }
.item .cost { color: var(--warn); font-size: 11px; }
.item.affordable { border-color: #4c5a35; }
.item.locked { opacity: .55; border-style: dashed; }
.item .lock { color: var(--dim); font-size: 11px; margin-top: 4px; }
.item button { width: 100%; margin-top: 5px; }

#predictSim {
  height: 118px;
  overflow-y: auto;
  border: 1px solid var(--line);
  background: #101208;
  padding: 5px 7px;
  margin: 6px 0;
  font-size: 11px;
  color: var(--dim);
}
#predictSim div { padding: 1px 0; }
#predictSim div.now { color: var(--accent); }

#console {
  height: 260px;
  overflow-y: auto;
  font-size: 11px;
  display: flex;
  flex-direction: column-reverse;
}
#console div { padding: 2px 0; border-bottom: 1px solid #23261b; color: var(--dim); }
#console div.hi { color: var(--accent); }

.hidden { display: none !important; }

#modalWrap {
  position: fixed; inset: 0;
  background: rgba(8,9,5,.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 20;
}
#modal {
  background: var(--panel);
  border: 1px solid #4a3129;
  padding: 16px 18px;
  max-width: 420px;
  width: calc(100% - 32px);
}
#modal h3 { margin: 0 0 8px; font-size: 14px; }
#modalBody { color: var(--dim); font-size: 12px; }
#modalBody ul { margin: 8px 0 0; padding-left: 18px; }
#modalBody strong { color: var(--text); }

@media (max-width: 1100px) {
  #board { grid-template-columns: repeat(2, minmax(210px, 1fr)); }
}
@media (max-width: 620px) {
  #board { grid-template-columns: 1fr; }
}
