/* Unciv Lite — BNB Testnet. Ancient-civilization theme.
 * Light neutral page, white cards, thin borders.
 * Main theme color: deep teal #0f766e (header + primary buttons).
 * Terrain / resource colors are used on the board and stats only. No gradients. */
* { box-sizing: border-box; }
:root {
  --bg: #f5f5f4;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --accent: #0f766e;
  --accent-dark: #0b5e57;
  --accent-light: #e6f4f2;
  --gold: #b45309;
  --gold-bg: #fef3c7;
  --amber: #d97706;
  --food: #16a34a;
  --slate: #64748b;
  --water: #6a9fd8;
  --forest: #2d6a4f;
  --grass: #7fb069;
  --plains: #dbe7a0;
  --desert: #e9c46a;
  --hills: #a08c7a;
}
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.wrap { max-width: 720px; margin: 0 auto; padding: 16px 12px 40px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}
/* ---- Thematic header band ---- */
.hero {
  background: var(--accent);
  border: 1px solid var(--accent-dark);
  border-radius: 10px;
  padding: 18px 16px 14px;
  margin-bottom: 12px;
  color: #ffffff;
}
.hero h1 { font-size: 22px; margin: 0 0 4px; color: #ffffff; letter-spacing: 0.5px; }
.hero .tagline {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #d1fae5;
}
.hero .tagline strong { color: #fde68a; font-weight: 700; }
.hero .hero-meta {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.hero .pill {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #ffffff;
  min-width: 0;
}
.hero button { background: #ffffff; color: var(--accent-dark); border: 1px solid #ffffff; }
.hero button:hover:not(:disabled) { background: #f0fdfa; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 0 0 10px; }
.sub { color: var(--muted); font-size: 13px; margin: 0; }
.goal-line {
  border-left: 4px solid var(--accent);
  background: var(--accent-light);
  padding: 8px 10px;
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  margin: 0 0 12px;
}
.goal-line strong { color: var(--accent-dark); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.space { justify-content: space-between; }
button {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
  min-height: 38px;
}
button:hover:not(:disabled) { background: var(--accent-dark); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
button.secondary:hover:not(:disabled) { background: #f9fafb; }
input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}
input[type="text"]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 6px; }
.pill {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--muted);
  background: #fff;
  min-width: 130px;
  text-align: center;
}
.pill.on { color: var(--accent); border-color: var(--accent); }
/* ---- Color-coded resources ---- */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.stat { border: 1px solid var(--border); border-top: 4px solid var(--slate); border-radius: 6px; padding: 8px 6px; text-align: center; }
.stat .k { font-size: 11px; color: var(--muted); }
.stat .v { font-size: 18px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.stat-turn { border-top-color: var(--accent); }
.stat-turn .v { color: var(--accent-dark); }
.stat-gold { border-top-color: var(--amber); }
.stat-gold .v { color: #92400e; }
.stat-food { border-top-color: var(--food); }
.stat-food .v { color: #166534; }
.stat-cities { border-top-color: var(--gold); }
.stat-cities .v { color: var(--gold); }
.stat-units { border-top-color: var(--slate); }
.stat-units .v { color: #334155; }
/* ---- Board: deterministic flat terrain colors, no gradients ---- */
.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}
.cell {
  aspect-ratio: 1;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 2px;
  min-height: 44px;
  user-select: none;
  color: #1f2937;
}
.cell:hover { outline: 2px solid var(--accent); outline-offset: -1px; }
.cell.selected { outline: 3px solid var(--accent-dark); outline-offset: -1px; }
.cell.t-grass { background: var(--grass); }
.cell.t-forest { background: var(--forest); color: #ffffff; }
.cell.t-forest .s, .cell.t-forest .hp { color: #d1fae5; }
.cell.t-plains { background: var(--plains); }
.cell.t-desert { background: var(--desert); }
.cell.t-water { background: var(--water); color: #ffffff; }
.cell.t-water .s, .cell.t-water .hp { color: #dbeafe; }
.cell.t-hills { background: var(--hills); color: #ffffff; }
.cell.t-hills .s, .cell.t-hills .hp { color: #fef3c7; }
/* Cities: keep terrain underneath, mark with a thick border + badge. */
.cell.city { border: 3px solid var(--gold); }
.cell.neutral { border: 3px solid var(--slate); }
.city-badge {
  display: inline-block;
  background: var(--gold-bg);
  color: #92400e;
  border: 1px solid var(--gold);
  border-radius: 4px;
  padding: 0 4px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}
.city-badge.neutral { background: #f1f5f9; color: #334155; border-color: var(--slate); }
.cell .t { font-size: 16px; font-weight: 700; line-height: 1.1; }
.cell .s { font-size: 10px; color: var(--muted); line-height: 1.1; text-align: center; }
.cell .hp { font-size: 10px; font-family: ui-monospace, monospace; color: var(--muted); }
/* Units: colored badges, not just text. */
.unit-badge {
  display: inline-block;
  border-radius: 4px;
  padding: 0 5px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  color: #ffffff;
  margin-top: 1px;
}
.unit-badge.u-warrior { background: #b91c1c; }
.unit-badge.u-settler { background: #0284c7; }
.unit-badge.u-archer { background: #166534; }
.cell .unit-name { font-size: 10px; line-height: 1.1; text-align: center; background: rgba(255, 255, 255, 0.85); border-radius: 3px; padding: 0 2px; color: #1f2937; }
/* Legend under the board */
.legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, 0.2); }
.sw-grass { background: var(--grass); }
.sw-forest { background: var(--forest); }
.sw-plains { background: var(--plains); }
.sw-desert { background: var(--desert); }
.sw-water { background: var(--water); }
.sw-hills { background: var(--hills); }
.sw-mycity { background: var(--gold-bg); border: 2px solid var(--gold); }
.sw-neutral { background: #f1f5f9; border: 2px solid var(--slate); }
.hint { font-size: 13px; color: var(--muted); min-height: 20px; margin: 8px 0 0; }
.log {
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 72px;
  max-height: 180px;
  overflow-y: auto;
  margin: 0;
}
.addr { font-family: ui-monospace, monospace; font-size: 12px; word-break: break-all; }
.footer { font-size: 12px; color: var(--muted); text-align: center; }
@media (max-width: 520px) {
  .stats { grid-template-columns: repeat(5, 1fr); gap: 4px; }
  .stat .v { font-size: 15px; }
  .cell { min-height: 38px; }
  .cell .t { font-size: 14px; }
  .hero h1 { font-size: 19px; }
}
