.operators {
  background: linear-gradient(160deg, rgba(9, 14, 25, 0.95) 0%, rgba(13, 20, 33, 0.8) 100%);
  border-radius: 16px;
  padding: clamp(1.5rem, 3vw, 3rem);
  color: #edf3ff;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.45);
}

.operator-panel {
  display: flex;
  gap: clamp(1.5rem, 3vw, 3rem);
  align-items: stretch;
  border: 1px solid rgba(88, 125, 179, 0.25);
  border-radius: 18px;
  background: rgba(8, 12, 20, 0.65);
  padding: clamp(1.25rem, 2.2vw, 2.5rem);
  backdrop-filter: blur(8px);
}

.operator-portrait {
  flex: 0 0 clamp(200px, 23vw, 280px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.operator-portrait img {
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 420px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(122, 161, 214, 0.3);
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.55);
  background: rgb(6, 9, 15);
}

.operator-loadout {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 2vw, 2rem);
}

.operator-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.operator-meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.operator-class {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  color: #8ea6c6;
}

.operator-callsign {
  font-size: clamp(1.6rem, 2.8vw, 2.4rem);
  font-weight: 600;
  color: #f4f7ff;
}

.operator-actions {
  display: flex;
  gap: 0.75rem;
}

.operator-actions .link-red {
  align-self: flex-start;
}

.gear-grid {
  display: grid;
  gap: clamp(1rem, 1.8vw, 1.6rem);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.gear-slot {
  position: relative;
  background: rgba(13, 19, 30, 0.75);
  border: 1px solid rgba(62, 93, 135, 0.45);
  border-radius: 14px;
  padding: 1rem 1.2rem 1.25rem;
  min-height: 124px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  overflow: visible;
}

.gear-slot:hover {
  border-color: rgba(102, 149, 214, 0.6);
  box-shadow: 0 16px 28px rgba(8, 14, 24, 0.55);
}

.gear-slot--filled {
  border-color: rgba(88, 159, 255, 0.55);
}

.gear-slot--open {
  border-color: rgba(124, 180, 255, 0.8);
  box-shadow: 0 18px 32px rgba(8, 14, 24, 0.7);
  z-index: 45;
}

.gear-slot-trigger {
  width: 100%;
  background: none;
  border: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: left;
}

.gear-slot-trigger:focus {
  outline: none;
}

.gear-slot-trigger:focus-visible {
  outline: 2px solid rgba(124, 180, 255, 0.7);
  outline-offset: 4px;
}

.gear-slot-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7f95b4;
}

.gear-slot-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(88, 159, 255, 0.4);
  background: rgba(88, 159, 255, 0.15);
  color: #c4d5ff;
  font-weight: 600;
  font-size: 0.75rem;
}

.gear-slot-value {
  flex: 1;
  text-align: right;
  font-weight: 500;
  color: #f2f5ff;
  font-size: 0.95rem;
}

.gear-slot--empty .gear-slot-value {
  color: #7387a5;
  font-weight: 400;
}

.gear-slot-caret {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: rgba(88, 159, 255, 0.12);
  color: #9fb9ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

.gear-slot--open .gear-slot-caret {
  transform: rotate(180deg);
}

.gear-slot-summary {
  margin-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 2.5rem;
}

.gear-slot-text {
  font-size: 0.85rem;
  line-height: 1.45;
  color: #9aa8bd;
  margin: 0;
}

.gear-slot-text--muted {
  color: #6e809d;
}

.gear-slot-inline-form {
  display: flex;
}

.gear-slot-unequip {
  background: none;
  border: 0;
  padding: 0;
  color: #ff9aa3;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(255, 154, 163, 0.4);
}

.gear-slot-unequip:hover,
.gear-slot-unequip:focus {
  color: #ffc0c8;
}

.gear-slot-unequip:focus-visible {
  outline: none;
  text-decoration-color: rgba(255, 175, 186, 0.7);
}

.gear-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 12px);
  width: min(100%, 340px);
  background: rgba(9, 13, 21, 0.98);
  border: 1px solid rgba(53, 78, 112, 0.65);
  border-radius: 14px;
  box-shadow: 0 24px 40px rgba(5, 10, 20, 0.75);
  padding: 0.75rem;
  max-height: 320px;
  overflow-y: auto;
  z-index: 50;
}

.gear-slot--drop-up .gear-menu {
  top: auto;
  bottom: calc(100% + 12px);
}

.gear-menu-option {
  margin: 0;
}

.gear-menu-option + .gear-menu-option {
  margin-top: 0.5rem;
}

.gear-menu-option button {
  width: 100%;
  border: 1px solid transparent;
  background: rgba(23, 32, 48, 0.72);
  color: #d9e6ff;
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.gear-menu-option button:hover,
.gear-menu-option button:focus,
.gear-menu-option button:focus-visible {
  border-color: rgba(124, 180, 255, 0.55);
  background: rgba(33, 48, 70, 0.92);
  transform: translateY(-1px);
}

.gear-menu-option--remove button {
  background: rgba(56, 22, 30, 0.82);
  border-color: rgba(204, 79, 107, 0.5);
  color: #ffb8c7;
}

.gear-menu-option--remove button:hover,
.gear-menu-option--remove button:focus,
.gear-menu-option--remove button:focus-visible {
  border-color: rgba(255, 137, 160, 0.7);
  background: rgba(72, 28, 38, 0.92);
}

.gear-menu-title {
  font-weight: 600;
  font-size: 0.92rem;
}

.gear-menu-text {
  font-size: 0.78rem;
  line-height: 1.35;
  color: #9fb2d3;
}

.gear-menu-empty {
  margin: 0;
  padding: 0.4rem 0.25rem;
  text-align: center;
  font-size: 0.82rem;
  color: #6c7d99;
}

.gear-menu-divider {
  border: 0;
  border-top: 1px solid rgba(62, 93, 135, 0.4);
  margin: 0.6rem 0;
}

.gear-empty-hint {
  margin: 0;
  font-size: 0.82rem;
  color: #7084a6;
}

@media (max-width: 980px) {
  .operator-panel {
    display: grid;
    grid-template-columns: minmax(190px, 34vw) 1fr;
    align-items: start;
    gap: clamp(1.2rem, 4vw, 2.4rem);
  }

  .operator-portrait {
    flex: none;
    width: 100%;
    justify-content: center;
  }

  .operator-portrait img {
    width: clamp(180px, 32vw, 240px);
    max-height: clamp(200px, 38vh, 280px);
  }

  .operator-loadout {
    width: 100%;
  }

  .operator-meta,
  .operator-actions {
    width: 100%;
  }

  .operator-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .operators {
    padding: clamp(1.1rem, 4vw, 1.5rem);
  }

  .operator-panel {
    grid-template-columns: minmax(160px, 38vw) 1fr;
    padding: 1.15rem;
    gap: clamp(1rem, 3.5vw, 2rem);
  }

  .operator-portrait img {
    width: clamp(160px, 44vw, 220px);
    max-height: clamp(180px, 32vh, 240px);
  }

  .gear-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: clamp(0.85rem, 3vw, 1.1rem);
  }

  .gear-slot {
    padding: 0.85rem 0.95rem 1rem;
  }

  .gear-menu {
    width: min(100%, 320px);
  }

  .operator-callsign {
    font-size: clamp(1.6rem, 5vw, 1.9rem);
  }
}

@media (max-width: 560px) {
  .operator-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    gap: 1.1rem;
  }

  .operator-portrait {
    width: 100%;
    justify-content: center;
  }

  .operator-portrait img {
    width: clamp(180px, 58vw, 220px);
    max-height: clamp(170px, 34vh, 220px);
  }

  .operator-loadout {
    width: 100%;
  }

  .gear-grid {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .gear-slot {
    padding: 0.78rem 0.85rem 0.95rem;
  }

  .gear-slot-trigger {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .gear-slot-value {
    text-align: left;
    font-size: 0.95rem;
  }

  .gear-slot-label {
    font-size: 0.76rem;
  }

  .gear-slot-caret {
    align-self: flex-end;
    width: 1.5rem;
    height: 1.5rem;
  }

  .gear-slot-badge {
    width: 1.8rem;
    height: 1.8rem;
    font-size: 0.68rem;
  }

  .gear-empty-hint {
    text-align: center;
  }
}

@media (max-width: 420px) {
  .operator-panel {
    padding: 0.85rem;
  }

  .gear-grid {
    gap: 0.65rem;
  }

  .gear-menu {
    left: 50%;
    transform: translateX(-50%);
    width: min(280px, calc(100vw - 1.5rem));
  }

  .gear-slot--drop-up .gear-menu {
    left: 50%;
    transform: translateX(-50%);
  }
}
