:root {
  --bg: #0d1117;
  --fg: #c9d1d9;
  --accent: #58a6ff;
  --muted: #8b949e;
  --card: #161b22;
  --border: #21262d;
  --green: #3fb950;
  --amber: #d29922;
  --red: #f85149;
}
* { box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.2rem 4rem;
  line-height: 1.6;
}
header { margin-bottom: 1.5rem; }
.brand {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
}
.tagline { color: var(--muted); margin-top: 0.4rem; font-size: 0.95rem; }
.nav { margin-top: 1rem; display: flex; gap: 1.2rem; border-bottom: 1px solid var(--border); padding-bottom: 0.8rem; }
.nav a { text-decoration: none; font-size: 0.9rem; color: var(--muted); }
.nav a:hover { color: var(--accent); }
a { color: var(--accent); }
.page-intro { color: var(--muted); margin-bottom: 1.5rem; }

.entries { list-style: none; padding: 0; }
.entry-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem 1.4rem;
  margin-bottom: 1rem;
}
.entry-card h2 { margin: 0 0 0.3rem; font-size: 1.15rem; }
.entry-card a { text-decoration: none; }
.meta { color: var(--muted); font-size: 0.85rem; margin: 0.2rem 0 0.6rem; }
.summary { margin: 0; color: var(--fg); }
.empty { color: var(--muted); font-style: italic; }
article h1 { margin-top: 1rem; }
.back { display: inline-block; margin-bottom: 1rem; font-size: 0.9rem; }
.body p { margin: 1rem 0; }
.body pre {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
}
.body code { background: var(--card); padding: 0.15rem 0.4rem; border-radius: 4px; }
footer { margin-top: 3rem; color: var(--muted); font-size: 0.8rem; text-align: center; }

.todo-col { margin-bottom: 2rem; }
.todo-col h2 { font-size: 1.05rem; border-bottom: 1px solid var(--border); padding-bottom: 0.4rem; }
.todo-list { list-style: none; padding: 0; margin: 0.8rem 0 0; }
.todo-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--muted);
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  margin-bottom: 0.5rem;
  font-size: 0.92rem;
}
.todo-item.doing { border-left-color: var(--amber); }
.todo-item.done { border-left-color: var(--green); color: var(--muted); text-decoration: line-through; }
.todo-item.pending { border-left-color: var(--accent); }

.game-over-banner {
  background: rgba(248, 81, 73, 0.15);
  border: 1px solid var(--red);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  color: var(--red);
  font-weight: 600;
}
.game-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.2rem 0 1.6rem;
}
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  min-width: 90px;
  text-align: center;
}
.stat-label { display: block; font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.stat-value { display: block; font-size: 1.2rem; font-weight: 700; margin-top: 0.2rem; }

.game-grid-wrap { margin-bottom: 2rem; }
.game-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 3px;
  max-width: 480px;
  margin: 0 auto;
  aspect-ratio: 1;
}
.cell {
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  aspect-ratio: 1;
}
.terrain-plains { background: #2e4a1f; }
.terrain-forest { background: #1b3d1b; }
.terrain-water { background: #17394d; }
.terrain-mountain { background: #3a3a3a; }
.cell.has-building { box-shadow: inset 0 0 0 2px rgba(255,255,255,0.15); }

.legend { display: flex; gap: 1rem; justify-content: center; margin-top: 0.8rem; font-size: 0.8rem; color: var(--muted); flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 0.4rem; }
.legend-item::before { content: ""; width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.legend-item.terrain-plains::before { background: #2e4a1f; }
.legend-item.terrain-forest::before { background: #1b3d1b; }
.legend-item.terrain-water::before { background: #17394d; }
.legend-item.terrain-mountain::before { background: #3a3a3a; }

.game-log ul { list-style: none; padding: 0; }
.log-entry {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.7rem;
}
.log-title { font-weight: 700; margin: 0 0 0.3rem; font-size: 0.9rem; color: var(--accent); }
.log-narration { margin: 0; font-size: 0.92rem; }
.log-event { margin: 0.4rem 0 0; font-size: 0.85rem; color: var(--amber); }

/* v2: season badge, chart, two-col, rival, achievements */
.season-badge {
  display: inline-block;
  font-size: 0.6em;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 0.5rem;
  text-transform: capitalize;
}
.season-printemps { background: rgba(63, 185, 80, 0.2); color: var(--green); }
.season-ete { background: rgba(210, 153, 34, 0.2); color: var(--amber); }
.season-automne { background: rgba(248, 149, 73, 0.2); color: #f89549; }
.season-hiver { background: rgba(88, 166, 255, 0.2); color: var(--accent); }

.history-chart { margin-bottom: 2rem; }
.chart-svg {
  width: 100%;
  height: 140px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.chart-line { stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-population { stroke: var(--accent); }
.chart-food { stroke: var(--green); }
.legend-item.legend-population::before { content: ""; width: 10px; height: 10px; border-radius: 2px; display: inline-block; background: var(--accent); margin-right: 0.3rem; }
.legend-item.legend-food::before { content: ""; width: 10px; height: 10px; border-radius: 2px; display: inline-block; background: var(--green); margin-right: 0.3rem; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin-bottom: 2rem;
}
.col-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.2rem;
}
.col-panel h2 { font-size: 1rem; margin-top: 0; }
.building-list, .citizen-list { list-style: none; padding: 0; margin: 0.5rem 0 0; font-size: 0.9rem; }
.building-list li, .citizen-list li { padding: 0.25rem 0; border-bottom: 1px solid var(--border); }
.building-list li:last-child, .citizen-list li:last-child { border-bottom: none; }
.citizen-role { color: var(--muted); font-size: 0.85em; }

.rival-panel {
  background: rgba(248, 81, 73, 0.06);
  border: 1px solid rgba(248, 81, 73, 0.3);
  border-radius: 10px;
  padding: 1.2rem 1.4rem;
  margin-bottom: 2rem;
}
.rival-panel h2 { margin-top: 0; }
.rival-stats { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.8rem; }
.posture-belliqueux { color: var(--red); }
.posture-prudent { color: var(--accent); }
.posture-croissance { color: var(--green); }
.rival-note { color: var(--muted); font-size: 0.78rem; margin-top: 0.6rem; }

.achievements-panel { margin-bottom: 2rem; }
.achievement-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.achievement {
  font-size: 0.82rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
}
.achievement.unlocked { border-color: var(--amber); color: var(--amber); }
.achievement.locked { color: var(--muted); }

@media (max-width: 640px) {
  .two-col { grid-template-columns: 1fr; }
}
