* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  background: radial-gradient(circle at top, #1e293b, #020617);
  color: #e5e7eb;
}

.game {
  background: rgba(15, 23, 42, 0.95);
  border-radius: 16px;
  padding: 20px 24px 24px;
  max-width: 1100px;
  width: 100%;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
  display: grid;
  grid-template-columns: 0.9fr 1.2fr 1.1fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .game {
    grid-template-columns: 1fr;
  }
}

.col {
  background: rgba(15, 23, 42, 0.9);
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  padding: 12px 12px 14px;
}

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #9ca3af;
  margin-bottom: 8px;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-size: 14px;
}

.stats-row span.label {
  color: #9ca3af;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: block;
}

.big-number {
  font-size: 24px;
  font-weight: 700;
}

.resources-list {
  font-size: 14px;
  margin-top: 4px;
}

.resources-list div {
  margin-bottom: 3px;
}

.small-muted {
  font-size: 11px;
  color: #6b7280;
}

.env-row {
  margin-top: 6px;
  font-size: 13px;
}

.bar {
  position: relative;
  margin-top: 2px;
  height: 10px;
  border-radius: 999px;
  background: #020617;
  overflow: hidden;
}

.bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 50%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  transition: width 0.1s linear;
}

.bar-fill.wildlife {
  background: linear-gradient(90deg, #f97316, #facc15);
}

/* Job summary (middle column) */

.jobs {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}

.job-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(31, 41, 55, 0.8);
}

.job-row:last-child {
  border-bottom: none;
}

.job-name {
  font-weight: 500;
}

.job-count {
  min-width: 28px;
  text-align: right;
  font-weight: 600;
}

/* Buttons */

button {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  padding: 3px 8px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.1s ease, transform 0.05s ease, border-color 0.1s ease;
}

button.primary {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border-color: rgba(34, 197, 94, 0.9);
  font-size: 13px;
  padding: 6px 12px;
  font-weight: 600;
  color: #ecfdf3;
  box-shadow: 0 8px 18px rgba(34, 197, 94, 0.35);
}

button.danger {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  border-color: rgba(248, 113, 113, 0.9);
  color: #fee2e2;
}

button:disabled {
  opacity: 0.45;
  cursor: default;
  box-shadow: none;
}

button:not(:disabled):active {
  transform: translateY(1px) scale(0.98);
}

/* Buildings & research */

.building-row {
  padding: 6px 0;
  border-bottom: 1px solid rgba(31, 41, 55, 0.7);
}

.building-row:last-child {
  border-bottom: none;
}

.building-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.building-name {
  font-weight: 500;
}

.cost {
  font-size: 11px;
  color: #9ca3af;
}

.research-list {
  font-size: 13px;
  display: grid;
  gap: 6px;
}

.tech {
  border-radius: 8px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  padding: 6px 8px;
  background: rgba(15, 23, 42, 0.9);
}

.tech-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.tech-name {
  font-weight: 500;
  font-size: 13px;
}

.tech-desc {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 2px;
}

.log {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 8px;
  max-height: 160px;
  overflow-y: auto;
  padding-right: 4px;
}

.log-entry {
  margin-bottom: 2px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* Click actions */

.click-actions {
  margin-top: 4px;
  display: grid;
  gap: 8px;
}

.click-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.click-label {
  font-weight: 500;
  font-size: 13px;
}

.click-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #020617;
  overflow: hidden;
}

.click-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c55e, #3b82f6);
  transition: width 0.08s linear;
}

.click-bar-fill.wood {
  background: linear-gradient(90deg, #a855f7, #6366f1);
}

/* Auto rest & villagers */

.auto-rest {
  font-size: 11px;
  display: grid;
  gap: 4px;
  margin-bottom: 4px;
}

.auto-rest-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.auto-rest label {
  display: flex;
  align-items: center;
  gap: 4px;
}

.auto-rest input {
  width: 52px;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  padding: 2px 6px;
  color: #e5e7eb;
  font-size: 11px;
}

.villagers-list {
  margin-top: 4px;
  max-height: none;
  overflow-y: visible;
  font-size: 12px;
}

.villager-row {
  padding: 4px 0;
  border-bottom: 1px solid rgba(31, 41, 55, 0.7);
}

.villager-row:last-child {
  border-bottom: none;
}

.villager-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.villager-name {
  font-weight: 500;
}

.villager-meta {
  font-size: 11px;
  color: #9ca3af;
}

.villager-bars {
  margin-top: 2px;
  display: grid;
  gap: 2px;
}

.mini-bar {
  height: 6px;
  border-radius: 999px;
  background: #020617;
  overflow: hidden;
}

.mini-bar-fill {
  height: 100%;
  width: 50%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ef4444, #f97316);
}

.mini-bar-fill.energy {
  background: linear-gradient(90deg, #22c55e, #3b82f6);
}

.mini-bar-fill.hunger {
  background: linear-gradient(90deg, #facc15, #eab308);
}

.villager-job {
  margin-top: 4px;
  display: flex;
  justify-content: flex-start;
}

.villager-job select {
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  font-size: 11px;
  padding: 2px 6px;
}

/* Bottom visuals: exploration map */

.visuals {
  margin-top: 10px;
  max-width: 1100px;
  width: 100%;
}

.visuals-inner {
  background: linear-gradient(to top, #0f172a, #020617);
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  padding: 10px 14px 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  font-size: 13px;
}

.visuals-title {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #9ca3af;
  margin-bottom: 6px;
}

/* Exploration grid */

.map-grid {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 2px;
  margin-top: 2px;
}

.map-tile {
  width: 100%;
  padding-bottom: 90%; /* slightly squished for more rows */
  position: relative;
  border-radius: 3px;
  background: #020617;
  border: 1px solid rgba(15, 23, 42, 0.8);
}

.map-tile-inner {
  position: absolute;
  inset: 1px;
  border-radius: 2px;
  background: radial-gradient(circle at 30% 20%, #111827, #020617);
  opacity: 0.35;
  transition: opacity 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.map-tile.explored .map-tile-inner {
  opacity: 1;
  background: radial-gradient(circle at 30% 20%, #16a34a, #065f46);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.map-tile.village .map-tile-inner {
  opacity: 1;
  background: radial-gradient(circle at 30% 20%, #f97316, #b45309);
  box-shadow: 0 0 10px rgba(248, 181, 82, 0.7);
}
