@font-face {
  font-family: "Bangers";
  src: url("../fonts/Bangers-Regular.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Stencil";
  src: url("../fonts/StardosStencil-Bold.ttf") format("truetype");
  font-display: swap;
}

:root {
  --ink: #1b1716;
  --ink-soft: #3a3330;
  --paper: #f6efdf;
  --paper-deep: #ece1c8;
  --card: #fffaf0;
  --red: #d33a2c;
  --red-deep: #a8281e;
  --olive: #56653a;
  --olive-deep: #3d4a27;
  --gold: #e8b93a;
  --sky: #8cc8ee;
  --steel: #7d8789;
  --muted: #6b625a;
  --line: 3px solid var(--ink);
  --shadow: 5px 5px 0 var(--ink);
  --radius: 4px;
  --page: min(1120px, 100% - 32px);
  --title: "Bangers", "Impact", "Noto Sans CJK SC", "Noto Sans CJK JP", system-ui, sans-serif;
  --label: "Stencil", "Courier New", monospace;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(rgba(27, 23, 22, 0.07) 1px, transparent 1.4px);
  background-size: 7px 7px;
  font: 17px/1.6 var(--body);
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--red-deep);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--red);
}

h1,
h2,
h3 {
  font-family: var(--title);
  font-weight: 400;
  letter-spacing: 0.03em;
  line-height: 1.1;
  margin: 0 0 0.5em;
}

h1 {
  font-size: clamp(2.6rem, 6vw, 4.4rem);
}

h2 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  margin-top: 1.6em;
}

h3 {
  font-size: 1.6rem;
}

/* La police de BD n'a ni idéogrammes ni kana : la police de repli, en gras, garde la hiérarchie. */
:lang(zh) :is(h1, h2, h3, .btn, .brand, .stats dd, .clock div),
:lang(ja) :is(h1, h2, h3, .btn, .brand, .stats dd, .clock div) {
  font-weight: 700;
  letter-spacing: 0;
}

p {
  margin: 0 0 1em;
  text-align: justify;
  hyphens: auto;
}

.wrap {
  width: var(--page);
  margin-inline: auto;
}

/* En-tête : bandeau noir comme celui du logo, filet rouge dessous. */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--ink);
  border-bottom: 4px solid var(--red);
}

.top .wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
}

.brand {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--paper);
  text-decoration: none;
  font: 1.7rem/1 var(--title);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.brand img {
  width: 40px;
  height: 40px;
}

.brand:hover {
  color: var(--gold);
}

.nav {
  margin-left: auto;
}

.lang {
  position: relative;
  flex-shrink: 0;
  font: 0.8rem var(--label);
}

.lang summary {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  cursor: pointer;
  color: var(--paper);
  border: 2px solid var(--paper);
  border-radius: var(--radius);
  padding: 4px 8px;
}

.lang summary::-webkit-details-marker {
  display: none;
}

.lang summary::after {
  content: "▾";
}

.lang summary:hover,
.lang[open] summary {
  border-color: var(--gold);
}

.lang ul {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--ink);
  border: 3px solid var(--red);
  border-radius: var(--radius);
  min-width: 160px;
}

.lang ul a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  color: var(--paper);
  text-decoration: none;
  border-radius: var(--radius);
  white-space: nowrap;
}

.lang ul a:hover,
.lang ul a[aria-current] {
  background: var(--ink-soft);
  color: var(--gold);
}

.flag {
  width: 21px;
  height: 14px;
  flex-shrink: 0;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.menu-toggle,
.nav label {
  display: none;
}

.nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav a {
  display: block;
  padding: 6px 8px;
  color: var(--paper);
  text-decoration: none;
  font: 0.8rem/1.2 var(--label);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border-radius: var(--radius);
}

.nav a:hover {
  background: var(--ink-soft);
  color: var(--gold);
}

.nav a[aria-current="page"] {
  background: var(--red);
  color: var(--paper);
}

@media (max-width: 1060px) {
  .nav label {
    display: block;
    cursor: pointer;
    color: var(--paper);
    font: 1rem var(--label);
    text-transform: uppercase;
    padding: 8px 12px;
    border: 2px solid var(--paper);
    border-radius: var(--radius);
  }
  .nav ul {
    display: none;
  }
  .menu-toggle:checked ~ ul {
    display: flex;
    flex-direction: column;
    position: absolute;
    right: 16px;
    left: 16px;
    top: 68px;
    padding: 10px;
    background: var(--ink);
    border: 3px solid var(--red);
  }
}

/* Bannière de page : titre en lettres de BD sur fond olive tramé. */
.banner {
  background-color: var(--olive);
  background-image: radial-gradient(rgba(0, 0, 0, 0.22) 1.2px, transparent 1.6px);
  background-size: 8px 8px;
  color: var(--paper);
  border-bottom: var(--line);
  padding: 48px 0 40px;
}

.banner h1 {
  color: var(--paper);
  text-shadow: 3px 3px 0 var(--red), 6px 6px 0 var(--ink);
  margin-bottom: 0.25em;
}

.banner p {
  max-width: 60ch;
  font-size: 1.15rem;
  margin: 0;
}

.kicker {
  display: inline-block;
  font: 0.9rem var(--label);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: var(--gold);
  color: var(--ink);
  padding: 2px 10px;
  border: 2px solid var(--ink);
  margin-bottom: 14px;
  transform: rotate(-1.5deg);
}

main {
  padding: 24px 0 72px;
}

main > .wrap > :first-child {
  margin-top: 0.6em;
}

.lead {
  font-size: 1.2rem;
  max-width: 68ch;
}

/* Panneaux : cadre d'encre épais et ombre portée pleine, comme une case de BD. */
.panel {
  background: var(--card);
  border: var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}

.panel > :last-child {
  margin-bottom: 0;
}

.grid {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}

.grid.wide {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr));
}

.callout {
  border: var(--line);
  border-left-width: 12px;
  border-left-color: var(--red);
  background: var(--card);
  padding: 14px 18px;
  margin: 1.4em 0;
  border-radius: var(--radius);
}

.callout.tip {
  border-left-color: var(--olive);
}

.callout.gold {
  border-left-color: var(--gold);
}

.callout strong:first-child {
  font-family: var(--label);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tag {
  display: inline-block;
  font: 0.78rem/1.4 var(--label);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 8px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper-deep);
  margin: 0 4px 4px 0;
}

.tag.red {
  background: var(--red);
  color: var(--paper);
}

.tag.olive {
  background: var(--olive);
  color: var(--paper);
}

.tag.sky {
  background: var(--sky);
}

.tag.gold {
  background: var(--gold);
}

/* Fiches d'unités et de bâtiments. */
.card {
  display: grid;
  grid-template-columns: 112px 1fr;
  grid-template-rows: auto auto 1fr;
  gap: 4px 16px;
  align-items: start;
}

.card .art {
  grid-row: span 3;
  background: radial-gradient(ellipse at 50% 85%, #8fae5a 0 45%, #6f8f42 46% 100%);
  border: var(--line);
  border-radius: var(--radius);
  aspect-ratio: 2 / 3;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}

.card .art.sky-bg {
  background: linear-gradient(#a9d8f2, #d9eef8);
}

.card .art img {
  width: 100%;
  image-rendering: auto;
}

.card h3 {
  margin: 0;
}

.card p {
  margin: 0 0 0.6em;
}

.card .tags {
  margin-top: 2px;
}

.stats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 6px;
  margin: 10px 0 0;
}

.stats div {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 3px 6px;
  text-align: center;
}

.stats dt {
  font: 0.68rem/1.2 var(--label);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.stats dd {
  margin: 0;
  font: 1.25rem/1.2 var(--title);
  letter-spacing: 0.04em;
}

/* Tableaux de chiffres. */
.table-scroll {
  overflow-x: auto;
  border: var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--card);
  margin: 1em 0 1.6em;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}

th,
td {
  padding: 7px 10px;
  text-align: center;
  border-bottom: 1px solid var(--paper-deep);
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

thead th {
  background: var(--ink);
  color: var(--paper);
  font: 0.8rem var(--label);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
}

tbody tr:nth-child(even) {
  background: rgba(236, 225, 200, 0.45);
}

td.no {
  color: var(--red-deep);
  font-weight: 700;
}

td.up {
  color: var(--red-deep);
}

/* Index de page : ancres vers les sections. */
.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0.5em 0 1.5em;
  padding: 0;
  list-style: none;
}

.toc a {
  display: inline-block;
  padding: 4px 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  font: 0.85rem var(--label);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.toc a:hover {
  background: var(--gold);
}

/* Règles : une fiche par règle, numérotée. */
.rules {
  counter-reset: rule;
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
}

.rule {
  counter-increment: rule;
  position: relative;
  padding-top: 26px;
}

.rule::before {
  content: counter(rule);
  position: absolute;
  top: -14px;
  left: 16px;
  min-width: 34px;
  height: 34px;
  padding: 0 6px;
  border: var(--line);
  border-radius: 999px;
  background: var(--gold);
  font: 1.2rem/28px var(--title);
  text-align: center;
}

.rule h3 {
  font-size: 1.45rem;
}

/* Étapes du tutoriel. */
.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 20px;
}

.steps > li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 16px;
  align-items: start;
}

.steps > li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: var(--line);
  border-radius: 50%;
  background: var(--red);
  color: var(--paper);
  font: 2rem/1 var(--title);
  box-shadow: 3px 3px 0 var(--ink);
}

.steps h3 {
  margin-top: 6px;
}

kbd {
  display: inline-block;
  font: 0.85em/1.3 var(--label);
  padding: 0 6px;
  border: 2px solid var(--ink);
  border-bottom-width: 4px;
  border-radius: 5px;
  background: var(--card);
}

/* Accueil : le QG du jeu en plein cadre, logo par-dessus. */
.hero {
  position: relative;
  border-bottom: var(--line);
  background: var(--ink) url("../img/hq.png") center 40% / cover no-repeat;
  min-height: min(78vh, 680px);
  display: flex;
  align-items: flex-end;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(27, 23, 22, 0.88), rgba(27, 23, 22, 0.15) 55%, transparent);
}

.hero .wrap {
  position: relative;
  z-index: 1;
  padding: 40px 0 44px;
}

.hero .logo {
  width: min(720px, 100%);
  filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35));
}

.hero p {
  color: var(--paper);
  font-size: clamp(1.1rem, 2.2vw, 1.35rem);
  max-width: 58ch;
  margin: 18px 0 22px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  border: var(--line);
  border-radius: var(--radius);
  background: var(--red);
  color: var(--paper);
  text-decoration: none;
  font: 1.35rem/1.1 var(--title);
  letter-spacing: 0.05em;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 0.08s, box-shadow 0.08s;
}

.btn:hover {
  color: var(--paper);
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
}

.btn.alt {
  background: var(--paper);
  color: var(--ink);
}

/* Steam : bouton de l'accueil, lien du pied de page et message d'attente. */
.btn.steam {
  background: #1b2838;
}

.btn.steam::before {
  content: "⬇ ";
}

.hero .only {
  margin: 14px 0 0;
  font: 0.95rem var(--label);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
}

.steam-link {
  font-family: var(--label);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.steam-dialog {
  max-width: min(520px, 100% - 32px);
  padding: 24px 26px 22px;
  border: var(--line);
  border-radius: 18px;
  box-shadow: 8px 8px 0 var(--ink);
  background: var(--card);
  color: var(--ink);
  text-align: center;
}

.steam-dialog::backdrop {
  background: rgba(27, 23, 22, 0.6);
}

.steam-dialog img {
  width: 96px;
  margin: -6px auto 4px;
  transform: rotate(-6deg);
}

.steam-dialog h2 {
  margin: 0 0 0.4em;
  color: var(--red);
}

.steam-dialog p {
  text-align: center;
}

.steam-dialog .soon {
  font-size: 0.92rem;
  color: var(--muted);
}

/* Défilé des unités sur l'accueil. */
.parade {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0 4px;
  padding: 10px 0 0;
}

.parade img {
  width: 80px;
  margin-top: -18px;
}

.features .panel h3 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.features .panel h3 img {
  width: 44px;
}

/* Cycle des heures : cadran de douze tours. */
.clock {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 1em 0 1.6em;
}

.clock div {
  border: var(--line);
  border-radius: var(--radius);
  padding: 8px 4px;
  text-align: center;
  font: 1.3rem/1.1 var(--title);
}

.clock small {
  display: block;
  font: 0.68rem/1.3 var(--label);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.clock .day {
  background: #ffe9a8;
}

.clock .dusk {
  background: #f2a66a;
}

.clock .night {
  background: #2b3550;
  color: var(--paper);
}

@media (max-width: 640px) {
  .clock {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Saisons : quatre panneaux teintés. */
.season {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 4px 16px;
}

.season .art {
  grid-row: span 2;
  border: var(--line);
  border-radius: var(--radius);
  aspect-ratio: 2 / 3;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.season.spring .art {
  background: #b9dd8a;
}

.season.summer .art {
  background: #f3d77a;
}

.season.autumn .art {
  background: #d99b5b;
}

.season.winter .art {
  background: #d6e7f2;
}

.season h3 {
  margin: 0;
}

/* Chaîne logistique : maillons reliés par des flèches. */
.chain {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
  margin: 1.2em 0 1.8em;
}

.chain .link {
  flex: 1 1 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--card);
  border: var(--line);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 10px 10px 12px;
}

.chain .link img {
  width: 76px;
  margin-bottom: 4px;
}

.chain .link strong {
  font: 1.25rem/1.1 var(--title);
  letter-spacing: 0.04em;
}

.chain .link span {
  font-size: 0.9rem;
  color: var(--muted);
}

.chain .arrow {
  align-self: center;
  font: 2.2rem/1 var(--title);
  color: var(--red);
}

@media (max-width: 760px) {
  .chain {
    flex-direction: column;
  }
  .chain .arrow {
    transform: rotate(90deg);
  }
}

/* Missions. */
.missions {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  counter-reset: mission;
}

.missions li {
  counter-increment: mission;
  background: var(--card);
  border: var(--line);
  border-radius: var(--radius);
  padding: 12px 16px 12px 62px;
  position: relative;
}

.missions li::before {
  content: counter(mission);
  position: absolute;
  left: 12px;
  top: 12px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--paper);
  border-radius: 50%;
  font: 1.2rem/1 var(--title);
}

.missions.campaign {
  counter-reset: mission 10;
}

.missions.campaign li::before {
  background: var(--red);
}

.missions strong {
  display: block;
  font: 1.3rem/1.15 var(--title);
  letter-spacing: 0.04em;
}

.missions span {
  font-size: 0.95rem;
}

.two-col {
  display: grid;
  gap: 28px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  align-items: start;
}

dl.keys {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  margin: 0;
}

dl.keys dt {
  font-weight: 700;
}

dl.keys dd {
  margin: 0;
}

.next {
  margin-top: 3em;
  display: flex;
  justify-content: flex-end;
}

footer {
  background: var(--ink);
  color: var(--paper-deep);
  border-top: 4px solid var(--red);
  padding: 28px 0;
  font-size: 0.92rem;
}

footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  align-items: center;
}

footer a {
  color: var(--gold);
}

footer a:hover {
  color: var(--paper);
}

.callout {
  text-align: justify;
  hyphens: auto;
}

/* Sur téléphone, le texte d'une fiche passe sous l'image : justifié dans une colonne de
   quelques mots, il ouvrirait de grands blancs, faute de césure dans certains navigateurs. */
@media (max-width: 560px) {
  .card p,
  .season p {
    grid-column: 1 / -1;
    margin-top: 10px;
  }
  .card .art {
    grid-row: span 2;
  }
  .season .art {
    grid-row: auto;
  }
  .card {
    grid-template-rows: auto 1fr;
  }
  .banner p {
    text-align: left;
  }
}

.nav label {
  white-space: nowrap;
}

@media (max-width: 560px) {
  .lang summary span {
    display: none;
  }
}
