/* OpenPanzer Lite — BNB Testnet. Military / field-map theme.
 * Light neutral page, white cards, thin borders.
 * Main theme color: military olive #4d7c0f (header + primary buttons).
 * Terrain / unit 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: #4d7c0f;
  --accent-dark: #3f6212;
  --accent-light: #f0f7e6;
  --gold: #b45309;
  --gold-bg: #fef3c7;
  --amber: #d97706;
  --player: #2563eb;
  --player-dark: #1e40af;
  --player-bg: #dbeafe;
  --enemy: #dc2626;
  --enemy-dark: #991b1b;
  --enemy-bg: #fee2e2;
  --slate: #64748b;
  --water: #5b8dc9;
  --forest: #2d6a4f;
  --grass: #8fae6a;
  --plains: #dbe7a0;
  --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: #ecfccb;
}
.hero .tagline strong { color: #fef08a; 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: #f7fee7; }
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); }
/* ---- How-to-play card ---- */
.howto h3 { font-size: 14px; margin: 12px 0 4px; }
.howto h3:first-child { margin-top: 0; }
.howto p { margin: 0 0 4px; font-size: 14px; }
.howto ul { margin: 4px 0 0; padding-left: 20px; font-size: 14px; }
.howto li { margin-bottom: 2px; }
.howto .unit-line { font-size: 13px; }
.howto .unit-line b { display: inline-block; min-width: 92px; }
.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(4, 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-prestige { border-top-color: var(--amber); }
.stat-prestige .v { color: #92400e; }
.stat-cities { border-top-color: var(--gold); }
.stat-cities .v { color: var(--gold); }
.stat-units { border-top-color: var(--player); }
.stat-units .v { color: var(--player-dark); }
/* ---- Board: deterministic flat terrain colors, no gradients ---- */
.board {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}
.cell {
  aspect-ratio: 1;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 1px;
  min-height: 40px;
  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.reachable { outline: 2px dashed var(--accent); outline-offset: -1px; }
.cell.t-plain { 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-hills { background: var(--hills); color: #ffffff; }
.cell.t-hills .s, .cell.t-hills .hp { color: #fef3c7; }
.cell.t-water { background: var(--water); color: #ffffff; cursor: not-allowed; }
.cell.t-water .s, .cell.t-water .hp { color: #dbeafe; }
/* Cities and HQs: thick border + badge, terrain stays underneath. */
.cell.city { border: 3px solid var(--gold); }
.cell.city.enemy { border-color: var(--enemy); }
.cell.city.neutral { border-color: var(--slate); }
.cell.hq { border: 3px solid var(--gold); }
.cell.hq.enemy { border-color: var(--enemy); }
.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.enemy { background: var(--enemy-bg); color: var(--enemy-dark); border-color: var(--enemy); }
.city-badge.neutral { background: #f1f5f9; color: #334155; border-color: var(--slate); }
.city-badge.hq { background: var(--gold-bg); }
.city-badge.hq.enemy { background: var(--enemy-bg); }
.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: owner-colored badges (blue player, red enemy). */
.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.player { background: var(--player); }
.unit-badge.enemy { background: var(--enemy); }
.unit-badge.acted { opacity: 0.55; }
.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-plain { background: var(--grass); }
.sw-forest { background: var(--forest); }
.sw-plains { background: var(--plains); }
.sw-hills { background: var(--hills); }
.sw-water { background: var(--water); }
.sw-mycity { background: var(--gold-bg); border: 2px solid var(--gold); }
.sw-enemyhq { background: var(--enemy-bg); border: 2px solid var(--enemy); }
.sw-neutral { background: #f1f5f9; border: 2px solid var(--slate); }
.sw-player { background: var(--player); }
.sw-enemy { background: var(--enemy); }
.hint { font-size: 13px; color: var(--muted); min-height: 20px; margin: 8px 0 0; }
.end-banner {
  border: 2px solid var(--accent);
  background: var(--accent-light);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-dark);
  margin: 10px 0 0;
}
.end-banner.lost { border-color: var(--enemy); background: var(--enemy-bg); color: var(--enemy-dark); }
.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(4, 1fr); gap: 4px; }
  .stat .v { font-size: 15px; }
  .cell { min-height: 34px; }
  .cell .t { font-size: 14px; }
  .hero h1 { font-size: 19px; }
}
