body {
  font-family: Arial, Helvetica, sans-serif;
  background: #111;
  color: #eee;
  padding: 20px;
}

h1 {
  margin-bottom: 12px;
}

/* =====================
   SELECTORS
   ===================== */
.record-selector {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.record-selector select,
.record-selector button {
  padding: 4px 8px;
}
.class-toggle {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.control-table {
  border-collapse: collapse;
  margin-bottom: 16px;
}

.control-table th,
.control-table td {
  border: none;
  padding: 3px 8px;
  vertical-align: top;
  background: transparent;
}

.control-table th {
  font-weight: normal;
  text-align: left;
}

.class-select-grid {
  border-collapse: collapse;
}

.class-select-grid td {
  border: none;
  padding: 1px 12px 1px 0;
  background: transparent;
}

.class-select-grid label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.control-table select,
.control-table button {
  padding: 4px 8px;
}
/* =====================
   META TABLE
   ===================== */
.mech-meta {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.mech-meta td {
  border: 1px solid #666;
  background: #181818;
  padding: 12px;
  vertical-align: top;
}

/* Highlight the parent stats cell containing MechData, Mobility, Armor, and Subsystems. */
.mech-stats-container-cell {
  background: #f2c94c !important;
}

.mech-image {
  width: 180px;
  text-align: center;
}

.mech-image img {
  max-width: 160px;
}

/* =====================
   META ROW (DYNAMIC)
   ===================== */
.meta-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.mechdata,
.mobility,
.subsystems {
  flex: 1;
  border-collapse: collapse;
}

.mech-id-card {
  flex: 0 0 clamp(130px, 14vw, 190px);
  width: clamp(130px, 14vw, 190px);
  min-height: 100%;
  aspect-ratio: 1 / 1;
  align-self: stretch;
  table-layout: fixed;
  border-collapse: collapse;
}

.mech-id-card th,
.mech-id-card td {
  border: 1px solid #666;
  background: #202020;
}

.mech-id-card th {
  height: 1%;
  padding: 4px 6px;
  background: #2a2a2a;
  text-align: center;
  white-space: nowrap;
}

.mech-id-card .mech-id-number {
  padding: 0.25rem;
  text-align: center;
  vertical-align: middle;
  font-size: clamp(2rem, 5.5vw, 5.75rem);
  font-weight: 800;
  line-height: 0.95;
  overflow-wrap: anywhere;
}

.mechdata th,
.mobility th,
.subsystems th,
.mechdata td,
.mobility td,
.subsystems td {
  border: 1px solid #666;
  padding: 4px 6px;
  background: #202020;
}

.mechdata th,
.mobility th,
.subsystems th {
  background: #2a2a2a;
  text-align: left;
}
/* =====================
   CONDITIONAL CELL COLORS
   ===================== */

.subsystem-yes {
  background: #04f304 !important;
  color: #d8ffd8 !important;
  font-weight: bold;
}

.subsystem-no {
  background: #3a0101 !important;
  color: #ffd8d8 !important;
  font-weight: bold;
}

.subsystem-unknown {
  background: #000000 !important;
  color: #000000 !important;
  font-style: italic;
}
.mechdata .label,
.mobility .label,
.subsystems .label {
  white-space: nowrap;
  font-weight: bold;
  background: #252525;
}

/* =====================
   ARMOR DATA
   ===================== */
.armordata {
  width: 100%;
  margin-top: 10px;
  border-collapse: collapse;
}

.armordata td {
  border: 1px solid #666;
  padding: 4px 6px;
  background: #202020;
  text-align: center;
}

.armordata .label {
  background: #252525;
  font-weight: bold;
  white-space: nowrap;
}

/* =====================
   WEAPONS TABLE
   ===================== */

.weapon-list .slot {
  border: none;
  box-shadow: none;
  background: transparent;
}

.mech-loadout {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin-top: 20px;
}

.mech-loadout th,
.mech-loadout td {
  border: 1px solid #666;
  padding: 6px;
  vertical-align: top;
}

.mech-loadout th {
  background: #222;
  text-align: center;
}

.weapon-col {
  background: #181818;
}

/* =====================
   WEAPON SECTIONS
   ===================== */

   .weapon-list {
  margin: 0;
  padding-left: 1.25rem;
}

.weapon-list .slot {
  display: list-item;
  margin: 0.25rem 0;
}

.weapon-list .slot-label {
  font-weight: bold;
}

.weapon-list .slot-value {
  display: inline;
}
.weapon-section {
  margin-bottom: 10px;
}

.weapon-section-title {
  background: #2a2a2a;
  border: 1px solid #555;
  padding: 3px 6px;
  font-size: 0.85em;
  font-weight: bold;
  text-align: center;
  margin-bottom: 4px;
}

.slot {
  border: 1px solid #444;
  margin-bottom: 4px;
}

.slot-label {
  background: #333;
  padding: 2px 4px;
  font-size: 0.8em;
  border-bottom: 1px solid #444;
}

.slot-value {
  padding: 4px;
  text-align: center;
}

.weapon-type-control {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.35rem;
  white-space: nowrap;
  font-size: 0.8rem;
}

.weapon-type-select {
  min-width: 7rem;
}

/* =====================
   COLLAPSIBLE NOTES
   ===================== */
.chassis-notes {
  width: 100%;
  margin-top: 14px;
  table-layout: fixed;
  border-collapse: collapse;
}

.chassis-notes td {
  border: 1px solid #666;
  padding: 6px 8px;
  background: #202020;
  vertical-align: top;
}

.chassis-notes .label {
  width: 160px;
  white-space: nowrap;
  font-weight: bold;
  background: #252525;
}

.notes {
  line-height: 1.4;
  white-space: pre-wrap;
}

.collapsible .collapse-header {
  cursor: pointer;
}

.collapsible .toggle-indicator {
  text-align: right;
  font-weight: bold;
  width: 40px;
}

.collapsible .collapse-content {
  display: none;
}

.collapsible.open .collapse-content {
  display: table-row;
}

.weapon-section.collapsible > .collapse-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.weapon-section.collapsible > .collapse-content {
  display: none;
}

.weapon-section.collapsible.open > .collapse-content {
  display: block;
}

.weapon-section.collapsible > .collapse-header:focus-visible {
  outline: 2px solid #ffd54a;
  outline-offset: 2px;
}

.collapse-header .label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}
/* Force hidden empty weapon slots to stay hidden */
.weapon-list .slot.is-empty,
.weapon-list .slot[hidden],
.weapon-section.is-empty,
.weapon-section[hidden] {
  display: none !important;
}\n\n/* =====================
   TOP-RIGHT MECH IDENTITY
   ===================== */
.mechbook-top-line {
  display: flex;
  align-items: stretch;
  width: 100%;
  margin-bottom: 16px;
}

.mechbook-top-line .control-table {
  flex: 0 0 auto;
  width: auto;
  margin-bottom: 0;
}

.mechbook-top-line .displayed-mech-identity {
  flex: 1 1 auto;
  min-width: 0;

  display: flex;
  align-items: center;
  justify-content: flex-end;

  padding: 0;
  margin: 0;

  color: #eee;
  background: transparent;

  /* Match the Mech ID number exactly. */
  font-size: clamp(2rem, 5.5vw, 5.75rem);
  font-weight: 800;
  line-height: 0.95;

  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 900px) {
  .mechbook-top-line {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .mechbook-top-line .displayed-mech-identity {
    flex-basis: 100%;
    justify-content: flex-end;
    min-height: 1.1em;
  }
}\n