:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  background: #151515;
  color: #f4f1ea;
}

* { box-sizing: border-box; }

body { margin: 0; }

header {
  align-items: end;
  background: #202020;
  border-bottom: 1px solid #45413a;
  display: flex;
  justify-content: space-between;
  padding: 24px max(24px, calc((100vw - 1280px) / 2));
}

h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.5rem, 3vw, 2.2rem); }

.eyebrow {
  color: #d5af59;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .12em;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.record-count { color: #b8b1a5; font-size: .9rem; }

main {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  margin: 0 auto;
  max-width: 1280px;
  min-height: calc(100vh - 95px);
}

aside {
  background: #1d1d1d;
  border-right: 1px solid #45413a;
  padding: 20px;
}

label {
  display: block;
  font-size: .8rem;
  font-weight: 700;
  margin: 0 0 7px;
}

input, select {
  background: #292929;
  border: 1px solid #5c584f;
  border-radius: 5px;
  color: inherit;
  font: inherit;
  margin-bottom: 16px;
  padding: 9px;
  width: 100%;
}

.select2-container { margin-bottom: 16px; }
.select2-container--default .select2-selection--single {
  background: #292929;
  border: 1px solid #5c584f;
  border-radius: 5px;
  height: 40px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: #f4f1ea;
  line-height: 38px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 38px; }
.select2-dropdown { background: #292929; border-color: #5c584f; color: #f4f1ea; }
.select2-container--default .select2-search--dropdown .select2-search__field {
  background: #151515;
  border-color: #5c584f;
  color: #f4f1ea;
}
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
  background: #796333;
}
.select2-container--default .select2-results__option--selected { background: #45413a; }

.build-list { display: grid; gap: 5px; max-height: calc(100vh - 255px); overflow-y: auto; }

.build-option {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: inherit;
  cursor: pointer;
  padding: 10px;
  text-align: left;
}

.build-option:hover, .build-option[aria-current="true"] { background: #37342e; border-color: #7d6a40; }
.build-option strong, .build-option small { display: block; }
.build-option small { color: #bbb4a8; font-size: .76rem; margin-top: 3px; }

.viewer { padding: 30px; }
.empty { color: #b8b1a5; padding: 40px 0; text-align: center; }

.build-heading {
  border-bottom: 1px solid #45413a;
  margin-bottom: 24px;
  padding-bottom: 18px;
}

.build-title-row { align-items: center; display: flex; gap: 12px; justify-content: space-between; }
.build-actions { align-items: center; display: flex; flex: 0 0 auto; gap: 8px; }
.run-build {
  background: #f4f1ea;
  border-radius: 6px;
  color: #151515;
  font-weight: 700;
  padding: 9px 10px;
  text-decoration: none;
}
.like-button {
  background: #34312b;
  border: 1px solid #d5af59;
  border-radius: 6px;
  color: #f4f1ea;
  cursor: pointer;
  flex: 0 0 auto;
  font-weight: 700;
  padding: 8px 10px;
}
.like-button[aria-pressed="true"] { background: #d5af59; color: #151515; }
.storage-error { color: #ff9e8e; font-size: .85rem; margin-top: 10px; }

.build-heading h2 { font-size: clamp(1.35rem, 2.5vw, 2rem); }
.meta { color: #c5bfae; font-size: .9rem; margin-top: 7px; }
.civilization-info { color: #d5af59; font-size: .84rem; line-height: 1.5; margin-top: 10px; }
.description { color: #d9d4c9; line-height: 1.5; margin-top: 14px; white-space: pre-line; }
.source { color: #e1bd69; display: inline-block; font-size: .9rem; margin-top: 12px; }

.age-section {
  background: #202020;
  border: 1px solid #45413a;
  border-radius: 7px;
  margin-bottom: 20px;
  overflow-x: auto;
}

table { border-collapse: collapse; min-width: 620px; width: 100%; }
thead { background: #34312b; }
th { color: #fff; font-size: .8rem; padding: 13px 12px; text-align: center; }
th:first-child { font-size: .9rem; text-align: left; }
.age-heading { align-items: center; display: inline-flex; gap: 8px; }
.age-icon { height: 24px; width: 24px; }
.header-icon { display: block; height: 18px; margin: auto; object-fit: contain; width: 18px; }
td { border-top: 1px solid #34312b; font-size: .9rem; padding: 8px 12px; text-align: center; }
td:first-child { line-height: 1.35; text-align: left; width: 72%; }
tbody tr:hover { background: #2a2824; }
.resource { font-weight: 700; width: 52px; }
.resource--hidden { color: transparent; }
.decision { background: #796333; border-radius: 5px; font-weight: 800; margin: 22px 0 9px; padding: 10px; text-align: center; }

@media (max-width: 750px) {
  header { align-items: start; flex-direction: column; gap: 8px; padding: 18px; }
  main { display: block; }
  aside { border-bottom: 1px solid #45413a; border-right: 0; }
  .build-list { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 250px; }
  .viewer { padding: 20px 12px; }
  .villagers { display: none; }
}
