body {
  background: #03080f;
  color: #e8eef5;
  font-family: "Georgia", "Yu Mincho", serif;
  margin: 0;
  padding: 2em;
  min-height: 100vh;
}

h1 {
  text-align: center;
  color: #f4d88a;
  text-shadow: 0 0 10px rgba(244, 216, 138, 0.4);
  letter-spacing: 0.1em;
  margin-bottom: 1.5em;
}

.unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5em;
  max-width: 1400px;
  margin: 0 auto;
}

.unit-card {
  background: #112d4e;
  border: 2px solid #2a5d8a;
  border-radius: 6px;
  padding: 1.2em 1.4em;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.unit-card:hover {
  transform: translateY(-3px);
  border-color: #5a9dc8;
  box-shadow: 0 6px 24px rgba(80, 160, 220, 0.4);
}

.card-header {
  border-bottom: 1px solid #3a6d9a;
  padding-bottom: 0.6em;
  margin-bottom: 0.8em;
}

.card-header h2 {
  margin: 0;
  font-size: 1.15em;
  color: #f4d88a;
}

.battalions {
  display: inline-block;
  margin-top: 0.3em;
  font-size: 0.85em;
  color: #9ab8d4;
  font-style: italic;
}

.stats {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3em 1em;
  margin: 0 0 0.8em 0;
  font-size: 0.92em;
}

.stats dt {
  color: #c4a968;
  font-weight: bold;
}

.stats dd {
  margin: 0;
  color: #e8eef5;
}

.capabilities {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.88em;
  line-height: 1.5;
}

.capabilities li {
  padding: 0.25em 0;
  border-bottom: 1px dotted rgba(154, 184, 212, 0.2);
}

.capabilities li:last-child {
  border-bottom: none;
}

.capabilities strong {
  color: #9fd0f0;
}

/* Quality color-coding on the left edge */
.quality-below-average { border-left: 6px solid #8a8a8a; }
.quality-average       { border-left: 6px solid #6a9ebd; }
.quality-superior      { border-left: 6px solid #c4a968; }
.quality-elite         {
  border-left: 6px solid #c84040;
  box-shadow: 0 0 20px rgba(232, 193, 74, 0.3), 0 4px 16px rgba(0, 0, 0, 0.5); 
}

.division {
  max-width: 1400px;
  margin: 2.5em auto;
  padding: 1em 1.5em 2em;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.division-header {
  font-size: 1.5em;
  letter-spacing: 0.08em;
  padding: 0.4em 0.8em;
  margin: 0 0 1.2em 0;
  border-left: 6px solid;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.35);
}

.division .unit-card {
  font-size: 0.95em;
  display: flex;
  flex-direction: column;
}

.division .unit-card h2 {
  font-size: 1.15em;
  line-height: 1.3;
}

.division .unit-card .battalions {
  font-size: 0.85em;
}

.division .unit-card .stats {
  font-size: 0.92em;
}

.division .unit-card .capabilities {
  font-size: 0.88em;
  line-height: 1.5;
  flex-grow: 1;
}

/* Keep the Special Division's header identical in weight to the others */
.division-special .division-header {
  font-size: 1.5em;
  font-weight: normal;
}

/* Optional: cap very long capability lists so they don't stretch the card */
.unit-card .capabilities {
  max-height: 220px;
  overflow-y: auto;
  padding-right: 0.4em;
}

/* Gold — Special */
.division-special {
  background: linear-gradient(180deg, rgba(80, 60, 10, 0.25), rgba(10, 30, 55, 0.1));
  box-shadow: inset 0 0 40px rgba(232, 193, 74, 0.1);
}
.division-special .division-header {
  color: #f4d88a;
  border-left-color: #e8c14a;
  text-shadow: 0 0 12px rgba(244, 216, 138, 0.5);
}

/* Red — Elite Shock */
.division-shock {
  background: linear-gradient(180deg, rgba(80, 20, 20, 0.25), rgba(10, 30, 55, 0.1));
  box-shadow: inset 0 0 40px rgba(200, 60, 60, 0.1);
}
.division-shock .division-header {
  color: #f0a0a0;
  border-left-color: #c84040;
  text-shadow: 0 0 12px rgba(200, 60, 60, 0.5);
}

/* Light Blue — Core */
.division-core {
  background: linear-gradient(180deg, rgba(20, 60, 100, 0.25), rgba(10, 30, 55, 0.1));
  box-shadow: inset 0 0 40px rgba(100, 180, 230, 0.1);
}
.division-core .division-header {
  color: #a8d4f4;
  border-left-color: #5aa8d8;
  text-shadow: 0 0 12px rgba(100, 180, 230, 0.5);
}

/* Green — Skirmisher */
.division-skirmisher {
  background: linear-gradient(180deg, rgba(20, 70, 40, 0.25), rgba(10, 30, 55, 0.1));
  box-shadow: inset 0 0 40px rgba(80, 180, 120, 0.1);
}
.division-skirmisher .division-header {
  color: #a0e0b0;
  border-left-color: #5ac880;
  text-shadow: 0 0 12px rgba(80, 180, 120, 0.5);
}

.chart-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 2em;
  max-width: 1400px;
  margin: 3em auto;
  padding: 0 1em;
}

.chart-figure {
  flex: 1 1 380px;
  max-width: 450px;
  margin: 0;
  padding: 1.5em;
  background: linear-gradient(180deg,
              rgba(15, 40, 70, 0.9) 0%,
              rgba(8, 25, 45, 0.9) 100%);
  border: 2px solid #2a5d8a;
  border-radius: 10px;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.6),
    inset 0 0 60px rgba(30, 80, 130, 0.25),
    0 0 0 1px rgba(244, 216, 138, 0.1);
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chart-figure:hover {
  transform: translateY(-4px);
  box-shadow:
    0 12px 32px rgba(80, 160, 220, 0.3),
    inset 0 0 60px rgba(30, 80, 130, 0.35),
    0 0 0 1px rgba(244, 216, 138, 0.25);
}

.chart-figure::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  bottom: 8px;
  border: 1px solid rgba(244, 216, 138, 0.15);
  border-radius: 6px;
  pointer-events: none;
}

.chart-figure figcaption {
  font-family: "Shippori Mincho", "Georgia", "Yu Mincho", serif;
  color: #f4d88a;
  font-size: 1.15em;
  margin-bottom: 1em;
  text-align: center;
  letter-spacing: 0.08em;
  text-shadow: 0 0 12px rgba(244, 216, 138, 0.4);
  padding-bottom: 0.8em;
  border-bottom: 1px solid rgba(244, 216, 138, 0.2);
}

.chart-figure svg {
  display: block;
  margin: 0 auto 1.2em;
  width: 100%;
  max-width: 280px;
  height: auto;
  filter:
    drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5))
    drop-shadow(0 0 8px rgba(100, 180, 230, 0.2));
}

.chart-legend {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.9em;
  color: #e8eef5;
  line-height: 1.6;
}

.chart-legend li {
  padding: 0.35em 0;
  display: flex;
  align-items: center;
  gap: 0.7em;
  border-bottom: 1px dotted rgba(154, 184, 212, 0.15);
}

.chart-legend li:last-child {
  border-bottom: none;
}

.chart-legend .swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
}

/* --- Main Layout --- */
.intro-columns {
  display: flex;
  flex-direction: column;
  gap: 1.5em;
  max-width: 900px;
  margin: 2em auto;
}

.intro-box {
  background: rgba(10, 30, 55, 0.85);
  border: 2px solid #2a5d8a;
  border-radius: 6px;
  padding: 1.5em 1.8em;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5),
              inset 0 0 40px rgba(30, 80, 130, 0.2);
  color: #e8eef5;
}

.intro-box h2 {
  color: #f4d88a;
  font-family: "Georgia", "Yu Mincho", serif;
  font-size: 1.3em;
  margin: 0 0 1em 0;
  padding-bottom: 0.5em;
  border-bottom: 1px solid #3a6d9a;
  letter-spacing: 0.05em;
  text-shadow: 0 0 10px rgba(244, 216, 138, 0.3);
}

.intro-box p {
  line-height: 1.65;
  margin: 0 0 1em 0;
  text-align: justify;
  font-size: 0.95em;
}

.intro-box p:last-child {
  margin-bottom: 0;
}

.intro-box strong {
  color: #f4d88a;
}

.intro-box em {
  color: #9fd0f0;
  font-style: italic;
}

/* --- The Grid Wrapper: Flows Left-to-Right, then Top-to-Bottom --- */
.race-grid {
  display: grid;
  /* This magic line says: make columns at least 280px wide, and auto-fit them.
     If there's room, they sit side-by-side. If not, they wrap to the next line. */
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5em;
  align-items: start;
}

/* --- Individual Race Cards --- */
.race-entry {
  display: flex;
  flex-direction: column; /* Keeps portrait ON TOP of text within the card */
  align-items: center;    /* Centers the portrait and text */
  background: rgba(0, 0, 0, 0.2); /* Slight dark background to distinguish cards */
  border: 1px solid rgba(42, 93, 138, 0.5);
  border-radius: 6px;
  padding: 1.2em;
}

.race-portrait {
  width: 110px;
  height: 110px;
  object-fit: cover;
  border-radius: 50%;     /* Circular portraits */
  border: 2px solid #3a6d9a;
  box-shadow: 0 0 12px rgba(244, 216, 138, 0.35),
              0 4px 8px rgba(0, 0, 0, 0.6);
  flex-shrink: 0;
  background: #0a1f3a;
  margin-bottom: 1em;     /* Space between circle and text */
}

.race-entry p {
  margin: 0;
  text-align: justify;
  font-size: 0.9em;       /* Slightly smaller text so it fits neatly in columns */
  line-height: 1.6;
}

.intro-box h3 {
  color: #9fd0f0;
  font-family: "Georgia", "Yu Mincho", serif;
  font-size: 1.1em;
  margin: 1.5em 0 0.6em 0;
  padding-bottom: 0.3em;
  border-bottom: 1px solid rgba(159, 208, 240, 0.25);
  letter-spacing: 0.05em;
  text-shadow: 0 0 8px rgba(159, 208, 240, 0.2);
}

.intro-box ul {
  margin: 0.5em 0 1em 1.2em;
  padding: 0;
  line-height: 1.65;
  font-size: 0.95em;
}

.intro-box li {
  margin-bottom: 0.6em;
}

.strategic-briefing {
  background: rgba(10, 30, 55, 0.85);
  border: 2px solid #c84040; /* Red border for military intel */
  border-radius: 6px;
  padding: 1.5em 1.8em;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5),
              inset 0 0 40px rgba(100, 20, 20, 0.15);
  color: #e8eef5;
  max-width: 900px;
  margin: 2em auto;
}

.strategic-briefing h2 {
  color: #f0a0a0;
  font-family: "Georgia", "Yu Mincho", serif;
  font-size: 1.3em;
  margin: 0 0 1em 0;
  padding-bottom: 0.5em;
  border-bottom: 1px solid #c84040;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(200, 60, 60, 0.4);
}

.strat-trait {
  margin-bottom: 1.2em;
}

.strat-trait-title {
  color: #f4d88a;
  font-weight: bold;
  font-size: 1em;
  margin-bottom: 0.2em;
}

.strat-trait-content {
  margin: 0;
  line-height: 1.6;
  font-size: 0.93em;
  text-align: justify;
}
