/* How to Play (/how-to-play): an intro, contents in three parts, then numbered steps down a line, each a box with its
   text and a picture (the picture on alternating sides; under the text on a narrow screen) */
.HowToPlayPage {
  height: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  padding: 40px 16px;
  color: rgba(255, 255, 255, 0.88);
}

.HowToPlayPage .howToPlay {
  max-width: 1180px;
  margin: 0 auto;
  font-size: 17px;
  line-height: 1.5;
}

.HowToPlayPage strong {
  color: white;
}

.HowToPlayPage p {
  margin: 0 0 10px;
}

.HowToPlayPage ul {
  margin: 0 0 10px;
  padding-left: 22px;
}

.HowToPlayPage a {
  color: #b9a3f5;
}

/* The intro: the title, what the game is, how it's meant to be played */
.HowToPlayPage .intro {
  text-align: center;
}

.HowToPlayPage h2 {
  margin: 0 0 12px;
  font-size: 44px;
  color: white;
}

.HowToPlayPage .lead {
  max-width: 760px;
  margin: 0 auto 12px;
  font-size: 21px;
  color: white;
}

.HowToPlayPage .spirit {
  max-width: 760px;
  margin: 0 auto 24px;
  font-style: italic;
  color: rgba(255, 255, 255, 0.65);
}

/* The contents: a row per part, its name then its steps as numbered pills */
.HowToPlayPage .contents {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 32px 0 8px;
}

.HowToPlayPage .contents .part {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.HowToPlayPage .contents .partName {
  width: 140px;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.HowToPlayPage .contents a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px 4px 4px;
  border-radius: 18px;
  background: rgba(118, 75, 162, 0.35);
  color: white;
  font-size: 15px;
  text-decoration: none;
}

.HowToPlayPage .contents a:hover {
  background: rgba(118, 75, 162, 0.7);
}

.HowToPlayPage .contents .number {
  width: 26px;
  height: 26px;
  font-size: 14px;
}

/* A step's number: a purple circle (the steps' line runs through them) */
.HowToPlayPage .number {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-weight: bold;
}

/* A part's name, then its steps */
.HowToPlayPage h3.partName {
  margin: 40px 0 8px 64px;
  font-size: 15px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #b9a3f5;
}

/* A step: its number on the line down the left, then its box */
.HowToPlayPage .step {
  position: relative;
  display: flex;
  gap: 20px;
  padding-bottom: 20px;
  scroll-margin-top: 16px;
}

.HowToPlayPage .step::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 21px;
  width: 2px;
  background: rgba(185, 163, 245, 0.3);
}

.HowToPlayPage .step > .number {
  position: relative; /* over the line */
  width: 44px;
  height: 44px;
  font-size: 20px;
}

.HowToPlayPage .step .content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px 40px;
  padding: 20px 24px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Every other step has its picture on the left */
.HowToPlayPage .part .step:nth-of-type(even) .content {
  flex-direction: row-reverse;
}

.HowToPlayPage .step .text {
  flex: 1 1 340px;
}

.HowToPlayPage h4 {
  margin: 0 0 8px;
  font-size: 26px;
  color: white;
}

.HowToPlayPage .step .picture {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  pointer-events: none; /* a picture: its buttons don't do anything */
}

.HowToPlayPage .picture button {
  margin: 0;
  font-size: 15px;
  padding: 8px 16px;
}

.HowToPlayPage .cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

/* A small map (RuleExamples' MapDiagram): 44px squares, a character's portrait on its square */
.HowToPlayPage .mapDiagram {
  margin: 0;
  text-align: center;
}

.HowToPlayPage .mapDiagram .squares {
  display: grid;
  grid-auto-rows: 44px;
  gap: 2px;
  justify-content: center;
}

.HowToPlayPage .mapDiagram .square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  background: #3d4a36; /* ground */
  font-size: 13px;
  color: white;
}

.HowToPlayPage .mapDiagram .square img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.HowToPlayPage .mapDiagram .square.place { background: #2e8b3e; }
.HowToPlayPage .mapDiagram .square.range { background: rgba(211, 47, 47, 0.75); }
.HowToPlayPage .mapDiagram .square.wall { background: #555; }
.HowToPlayPage .mapDiagram .square.fog { background: #151515; }
.HowToPlayPage .mapDiagram .square.outOfBounds { background: rgba(211, 47, 47, 0.75); }

.HowToPlayPage .mapDiagram .square.lastSeen img {
  opacity: 0.45;
}

.HowToPlayPage .mapDiagram .square.lastSeen span {
  position: absolute;
  bottom: -2px;
  font-size: 9px;
  white-space: nowrap;
}

.HowToPlayPage .mapDiagram figcaption {
  margin-top: 8px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
}

/* Force Lift's tokens on Luke */
.HowToPlayPage .tokenExample {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 5px;
}

/* The character's portrait (not its token badges' icons), then its badges in a column as tall as it, like the game's
   CharacterProfile */
.HowToPlayPage .tokenExample .profile {
  display: flex;
  align-items: flex-start;
}

.HowToPlayPage .tokenExample img.portrait {
  width: 165px;
  height: 165px;
  border-radius: 4px;
  object-fit: cover;
}

.HowToPlayPage .tokenExample .TokenBadges {
  height: 165px;
  margin: 0 0 0 6px;
}

/* Setup's game code, with its copy buttons */
.HowToPlayPage .codeTile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 26px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
}

.HowToPlayPage .codeTile .label {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.HowToPlayPage .codeTile .code {
  font-family: monospace;
  font-size: 40px;
  font-weight: bold;
  letter-spacing: 0.15em;
  color: white;
}

.HowToPlayPage .codeTile .buttons {
  display: flex;
  gap: 8px;
}

/* Setup's settings, as switches and a number, then Ready */
.HowToPlayPage .settings {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 280px;
}

.HowToPlayPage .setting {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 16px;
}

.HowToPlayPage .setting .value {
  font-weight: bold;
  color: white;
}

.HowToPlayPage .toggle {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.25);
}

.HowToPlayPage .toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
}

.HowToPlayPage .toggle.on {
  background: #7c5cd6;
}

.HowToPlayPage .toggle.on::after {
  left: 21px;
}

/* Drawn like the bar's end's big buttons (Ready, End Turn) */
.HowToPlayPage .bigButton,
.HowToPlayPage .screen .endTurn {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: #7c5cd6;
  color: white;
  font-weight: bold;
}

.HowToPlayPage .bigButton {
  height: 64px;
  font-size: 30px;
}

/* The rolled roster (the setup's own Roster), then Reroll and Claim under it */
.HowToPlayPage .rolling {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* The roster as the mouse is on it: View Deck showing */
.HowToPlayPage .rolling .Roster.viewsDeck .viewDeckHint {
  opacity: 1;
}

.HowToPlayPage .rolling .buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* What things cost a turn */
.HowToPlayPage .costs {
  border-collapse: collapse;
  font-size: 16px;
}

.HowToPlayPage .costs td {
  padding: 5px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.HowToPlayPage .costs td.cost,
.HowToPlayPage .costs td.free {
  text-align: center;
  font-weight: bold;
}

.HowToPlayPage .costs td.cost { color: #f0a63a; }
.HowToPlayPage .costs td.free { color: #5fd47a; }

.HowToPlayPage .note {
  margin: -6px 0 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
}

/* The game's screen, sketched: the map top left, the log beside it, the action bar under both */
.HowToPlayPage .screen {
  display: grid;
  grid-template-columns: 200px 70px;
  grid-template-rows: 120px 54px;
  grid-template-areas: 'map log' 'bar bar';
  gap: 3px;
  padding: 3px;
  border-radius: 8px;
  background: #111;
  font-size: 12px;
}

.HowToPlayPage .screen .map {
  grid-area: map;
  display: flex;
  align-items: center;
  justify-content: space-around;
  border-radius: 4px;
  background: #3d4a36;
}

.HowToPlayPage .screen .map img {
  width: 40px;
  height: 40px;
}

.HowToPlayPage .screen .log {
  grid-area: log;
  padding: 6px;
  border-radius: 4px;
  background: #2a2a2a;
  color: rgba(255, 255, 255, 0.6);
}

.HowToPlayPage .screen .bar {
  grid-area: bar;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 5px;
  border-radius: 4px;
  background: #000;
}

.HowToPlayPage .screen .card {
  width: 30px;
  height: 42px;
  border-radius: 3px;
  background: linear-gradient(#b3261e 0 30%, #ddd 30%);
}

.HowToPlayPage .screen .endTurn {
  margin-left: auto;
  height: 42px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13px;
}

/* The movement die's six faces, drawn like the game's die (MovementDie) */
.HowToPlayPage .dieFaces {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

/* An attack card minus a defense card, and the damage */
.HowToPlayPage .damage {
  display: flex;
  align-items: center;
  gap: 4px;
}

.HowToPlayPage .damage .sign {
  font-size: 34px;
  font-weight: bold;
  color: white;
}

.HowToPlayPage .damage .result {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-left: 6px;
  font-size: 44px;
  font-weight: bold;
  line-height: 1;
  color: #ff6b5e;
}

.HowToPlayPage .damage .result span {
  font-size: 14px;
  font-weight: normal;
  color: rgba(255, 255, 255, 0.7);
}

.HowToPlayPage .alliances {
  display: flex;
  align-items: center;
  gap: 8px;
}

.HowToPlayPage .alliances .badge {
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: bold;
}

.HowToPlayPage .alliances .badge.ally { background: #28a745; }
.HowToPlayPage .alliances .badge.enemy { background: #dc3545; }

/* The last roster standing (one character fallen, greyed out), and the banner a victor gets */
.HowToPlayPage .ending {
  display: flex;
  align-items: center;
  gap: 16px;
}

.HowToPlayPage .ending .victory {
  padding: 12px 22px;
  border-radius: 10px;
  background: #28a745;
  color: white;
  font-size: 26px;
  font-weight: bold;
}

/* A narrow screen: a smaller number and line, and every picture under its text */
@media (max-width: 700px) {
  .HowToPlayPage h2 {
    font-size: 34px;
  }

  .HowToPlayPage .lead {
    font-size: 18px;
  }

  .HowToPlayPage h3.partName {
    margin-left: 0;
  }

  .HowToPlayPage .step {
    gap: 10px;
  }

  .HowToPlayPage .step::before {
    left: 15px;
  }

  .HowToPlayPage .step > .number {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  .HowToPlayPage .step .content,
  .HowToPlayPage .part .step:nth-of-type(even) .content {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
  }

  .HowToPlayPage .step .text {
    flex: none;
  }

  .HowToPlayPage .contents .partName {
    width: 100%;
  }

  /* The sum's cards drawn smaller, so it stays on one line */
  .HowToPlayPage .damage {
    zoom: 0.5;
  }
}
