@font-face {
    font-family: 'ZektonRg';
    src: url('Zekton Rg.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

html, body {
    height: 100%;
    margin: 0;
    box-sizing: border-box;
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column; /* header + main stacked; main gets the remaining space */
    font-family: 'ZektonRg', sans-serif;
    background-color: rgb(71, 71, 71);
    color: white;
}

/* header stays natural height */
header {
    flex: 0 0 auto;
    border-bottom: 2px solid white;
    padding-bottom: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header .enginever {
    margin-right: 10px;
    font-weight: normal;
    opacity: 0.9;
}

header h1 {
    margin: 0 20px 0 10px;
    font-size: 1.9rem;
}

.content {
    flex: 1 1 auto;
    min-height: 0; /* allow children to use available space without forcing overflow */
    display: grid;
    grid-template-columns: 1fr 2fr; /* left = 1/3, right = 2/3 */
    gap: 10px;
    align-items: stretch;
    margin: 0 10px;
}

/* columns fill the full height of .content */
.col {
    height: 100%;
    background: rgba(255,255,255,0.03);
    padding: 8px;
    border-radius: 6px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.col.left .infiltrator,
.col.left .loadout {
    flex: 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: visible;
}

@media (max-width: 720px) {
    .content {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .col.left .infiltrator,
    .col.left .loadout {
        flex: none;
    }
}

button {
    background-color: rgb(114, 114, 114);
    border: rgb(0, 0, 0);
    border-width: 10px;
    color: rgb(255, 255, 255);
    padding: 10px 20px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 22px;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 12px;
    font-family: 'ZektonRg', sans-serif;
}

button:hover {
    background-color: rgb(87, 87, 87);
}

.infiltrator {
    background-color: rgb(68, 67, 67);
    border: black;
    color: rgb(255, 255, 255);
    padding: 10px 15px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    border-radius: 12px;
}

.loadout {
    background-color: rgb(68, 67, 67);
    border: black;
    color: rgb(255, 255, 255);
    padding: 5px 10px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    border-radius: 12px;
}

.content {
    display: grid;
    grid-template-columns: 1fr 2fr; /* left = 1/3, right = 2/3 */
    gap: 20px;
    align-items: stretch; 
    margin: 0 5px;
}

/* basic styling for columns */
.col {
    background: rgba(255,255,255,0.03);
    padding: 16px;
    border-radius: 6px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}


.infiltrator .infiltrator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

/* ensure stats appear directly under the header/button */
.infiltrator-stats {
    margin-top: 8px;
    padding-top: 8px;
}

/* small white divider similar to header border */
.infiltrator .divider {
    height: 2px;
    background: white;
    opacity: 0.9;
    border-radius: 2px;
    margin: 8px 0;
}

/* tweak spacing of stat sections */
.infiltrator .stat-section h4 {
    margin: 0 0 4px 0;
    font-weight: 600;
    font-size: 0.95rem;
}

.infiltrator .stat-section h2 {
    margin: 0;
    font-size: 1.15rem;
}

/* keep overflow visible so no internal scrolling */
.infiltrator { overflow: visible; }


/* small-screen: stack columns */
@media (max-width: 720px) {
    .content {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .col.left .infiltrator,
    .col.left .loadout {
        flex: none;
    }
}

.loadout-list {
  margin-top: 10px;
  width: 100%;
}

.loadout-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.loadout-list .item-label {
  flex: 1 1 0;
  min-width: 0; 
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}


.loadout-list .item-meta {
  flex: 0 0 auto;                      
  color: rgba(255,255,255,0.75);
  font-size: 0.9rem;
  text-align: left;
  white-space: nowrap;
}

.loadout-list li {
  position: relative;   
  overflow: visible; 
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  border-left: 4px solid rgba(255,255,255,0.08);
  transition: background 120ms ease, transform 120ms ease;
  font-size: 16px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* tooltip shown on hover */
.loadout-list .tooltip {
  position: absolute;
  top: calc(100% + 6px);
  left: calc(20%); 
  transform: translateY(-50%) scale(.96);
  opacity: 0;
  pointer-events: none;
  background: rgba(255,255,255,0.06);
  color: #fff;
  padding: 8px 10px;
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.6);
  white-space: nowrap;
  font-size: 13px;
  line-height: 1.2;
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 30;
}

.loadout-list li:hover,
.loadout-list li:focus-within {
  background: rgba(255,255,255,0.06);
  transform: translateY(-2px);
  cursor: pointer;
}

/* show tooltip on hover or keyboard focus */
.loadout-list li:hover .tooltip,
.loadout-list li:focus-within .tooltip {
  opacity: 1;
  transform: translateY(-50%) scale(1);
  pointer-events: auto;
}

/* ensure tooltips don't overflow the viewport on small screens:
   instead place them above the item (fallback) */
@media (max-width: 720px) {
  .loadout-list .tooltip {
    left: 50%;
    top: -8px;
    transform: translate(-50%, -100%) scale(.96);
    white-space: normal;
    max-width: 220px;
  }

  .loadout-list li:hover .tooltip,
  .loadout-list li:focus-within .tooltip {
    transform: translate(-50%,-100%) scale(1);
  }
}

/* responsive: slightly smaller on narrow screens */
@media (max-width: 520px) {
  .loadout-list li {
    padding: 8px 10px;
    font-size: 15px;
  }
}

.mission-title {
    text-align: left;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  z-index: 9999;
}

.modal[aria-hidden="false"] {
  display: flex;
}

.modal-panel {
  width: 92vw;
  height: 88vh;
  max-width: 1200px;
  max-height: 920px;
  background: rgba(20,20,20,0.98);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.7);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.modal-close {
  position: absolute;
  right: 20px;
  top: 18px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 26px;
  cursor: pointer;
}

.modal-header { display:flex; align-items:center; justify-content:space-between; }
.modal-title { margin: 0; font-size: 1.25rem; }

/* content scroll area */
.modal-body {
  overflow: hidden;
  padding-right: 6px;
  flex: 1 1 auto;
}

/* footer */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* small card styles for option lists inside modal */
.modal-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.modal-card {
  background: rgba(255,255,255,0.03);
  padding: 0px;
  border-radius: 8px;
  cursor: pointer;
  border-left: 4px solid rgba(255,255,255,0.06);
}

.modal-card:hover,
.modal-card:focus { transform: translateY(-4px); background: rgba(255,255,255,0.05); outline: none; }

/* simple form inside modal (loadout) */
.modal-form { display:flex; flex-direction:column; gap:10px; }
.modal-form .row { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:8px; background: rgba(255,255,255,0.02); border-radius:6px; }

/* adjust on small screens */
@media (max-width:720px) {
  .modal-panel { width: 96vw; height: 92vh; padding: 12px; }
  .modal-list { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}

/* small divider used inside the loadout modal */
.modal-divider {
  height: 2px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  margin: 8px 0;
}

/* simple item cards inside the modal */
.item-card {
  background: rgba(255,255,255,0.02);
  padding: 10px;
  border-radius: 8px;
  border-left: 4px solid rgba(255,255,255,0.06);
  color: #fff;
  cursor: pointer;
  text-align: left;
  transition: transform 120ms ease, background 120ms ease;
  position: relative;
}
.item-card .tooltip {
  display: none; /* keep simple; existing ARIA tooltip spans remain usable */
}
.item-card:hover {
  transform: translateY(-4px);
  background: rgba(255,255,255,0.035);
}

/* unavailable (can't add due to space) */
.item-card.unavailable {
  border-left-color: rgba(255,80,80,0.9);
  background: rgba(120,20,20,0.04);
  color: #ffb8b8;
  cursor: not-allowed;
}
.item-card.unavailable:hover { transform: none; background: rgba(120,20,20,0.04); }

.item-error {
  display: block;
  color: #ff8b8b;
  font-size: 0.76rem;
  line-height: 1;
  margin-top: 4px;
  opacity: 0.95;
}

/* gear button (small icon near each item) */
.gear-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.06);
  color: #fff;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
.gear-btn:hover { background: rgba(255,255,255,0.03); transform: none; }

/* mod chooser list (inline block) */
.mod-list { 
  display: flex; 
  flex-direction: column; 
  gap: 6px; 
}

/* small positioning helpers for chooser when absolute */
.mod-list.item-card { max-width: 320px; }

/* ensure add buttons inside all-items are small */
#allItems .add-base, #allItems .gear-add {
  background: rgba(255,255,255,0.02);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}
#allItems .add-base[disabled], #allItems .gear-add[disabled] { opacity: 0.6; cursor: not-allowed; }
