/* Rucksack Menu */
.rucksack-menu {
    position: fixed;
    top: 48%;
    left: 50.85%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background-color: #111b2e;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    color: #fff;
    width: 446px;
    max-width: 446px;
    height: auto;
    opacity: 0; /* Start hidden */
    display: none; /* Ensure hidden initially */
    animation: fadeIn 1s forwards;
    flex-direction: column;
    font-family: var(--dashboard-font-family, "Futura", "Trebuchet MS", "Avenir Next", Arial, sans-serif);
}

/* Rucksack Menu Header */
.rucksack-menu-header {
    background-color: #0a1221;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 10px;
    box-sizing: border-box;
    border-bottom: none;
}

/* Title aligned with items */
.rucksack-menu-header h2 {
    margin: 0;
    font-size: 24px;
    padding-left: 10px;
    font-family: var(--dashboard-font-family, "Futura", "Trebuchet MS", "Avenir Next", Arial, sans-serif);
}

/* Close button */
#rucksackMenu #closeRucksackMenu.close-button {
    background: none;
    border: none;
    border-radius: 0;
    color: #fff;
    font-family: "Arial Black", "Arial", sans-serif;
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    text-transform: none;
    transform: scaleY(0.9);
    transform-origin: center;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    margin-left: auto;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#rucksackMenu #closeRucksackMenu.close-button:focus-visible {
    background: transparent;
    color: #ffffff;
    outline: none;
}

@media (hover: hover) and (pointer: fine) {
    #rucksackMenu #closeRucksackMenu.close-button:hover {
        background: transparent;
        color: #ffffff;
        outline: none;
    }
}

/* Rucksack Menu Grid */
.rucksack-items-grid {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, 64px);
    grid-gap: 25px;
    justify-content: start;
    align-items: center;
    background-color: #111b2e;
    max-width: 400px;
    max-height: 400px;
    overflow-y: auto;
}

html.phone-optimised .rucksack-menu,
body.phone-optimised .rucksack-menu {
    width: min(410px, 88vw);
    max-width: min(410px, 88vw);
    top: calc(48% - var(--phone-tile-screen-size, 64px));
    left: 50%;
}

/* Rucksack Item */
.rucksack-item {
    position: relative;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
}

.rucksack-item-art {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* Quantity display for stacked items */
.rucksack-item-quantity {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background-color: rgba(0, 0, 0, 0.75);
    color: white;
    font-size: 12px;
    padding: 2px 5px;
    border-radius: 3px;
}

/* Fade-in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Fade-out animation */
@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}




/* TRADE MENU */

#hoodedTradeMenu,
#hoodedTradeMenu h2,
#hoodedTradeMenu span,
#hoodedTradeMenu button {
    font-family: var(--dashboard-font-family, "Futura", "Trebuchet MS", "Avenir Next", Arial, sans-serif);
}

#hoodedTradeMenu .rucksack-item {
    width: var(--trade-icon-size);
    height: var(--trade-icon-size);
}

#hoodedTradeMenu .upgrade-button{
    justify-content: center;   /* centers flex children horizontally   */
    text-align: center;        /* extra safety for plain text buttons  */
    padding-left: 0;           /* optional: remove the left bias       */
    padding-right: 0;          /* optional: keep overall width tighter */
}

#hoodedTradeMenu{
  --trade-icon-size: 70px;
  --trade-pill-width: var(--trade-icon-size);
}

#hoodedTradeMenu #closeHoodedTrade.close-button {
  width: auto;
  height: auto;
  margin-left: auto;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #f1f6ff;
  font-family: "Arial Black", "Arial", sans-serif;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  text-transform: none;
  transform: scaleY(0.9);
  transform-origin: center;
}

#hoodedTradeMenu #closeHoodedTrade.close-button:focus-visible {
  background: transparent;
  color: #ffffff;
  outline: none;
}

@media (hover: hover) and (pointer: fine) {
  #hoodedTradeMenu #closeHoodedTrade.close-button:hover {
    background: transparent;
    color: #ffffff;
    outline: none;
  }
}

/* trade grid card */
.trade-entry {
  width: 96px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  image-rendering: pixelated;
}

html.phone-optimised #hoodedTradeGrid,
body.phone-optimised #hoodedTradeGrid {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  column-gap: 0 !important;
}

html.phone-optimised #hoodedTradeGrid .trade-entry,
body.phone-optimised #hoodedTradeGrid .trade-entry {
  width: min(96px, 100%);
}

.trade-cost-label{
  font-size:12px;
  color:#ddd;
}

.trade-cost-wrapper{
  margin-top: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 28px;
}

.trade-cost-box{
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  width: var(--trade-pill-width);
  min-width: var(--trade-pill-width);
  min-height: 28px;
  padding: 0 2px;
  box-sizing: border-box;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
  color: #eef7ff;
  border: 1px solid transparent;
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(11, 19, 34, 0.98), rgba(7, 13, 24, 0.98)) padding-box,
    linear-gradient(
      135deg,
      #5fa9d6 0%,
      #2d78b7 50%,
      #123f74 100%
    ) border-box;
}

.trade-cost-box img{
  width: 20px;
  height: 20px;
  object-fit: contain;
  image-rendering: pixelated;
}

.trade-cost-qty{
  display: inline-block;
  white-space: nowrap;
  line-height: 1;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
}

.trade-button{
  position: relative;
  width: var(--trade-pill-width);
  min-width: var(--trade-pill-width);
  min-height: 28px;
  padding: 0 10px;
  box-sizing: border-box;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  line-height: 1;
  color: #eef7ff;
  border: 1px solid transparent;
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(19, 33, 58, 0.98), rgba(14, 26, 47, 0.98)) padding-box,
    linear-gradient(
      135deg,
      #5fa9d6 0%,
      #2d78b7 50%,
      #123f74 100%
    ) border-box;
  cursor: pointer;
  transition:
    background 120ms ease,
    color 120ms ease,
    filter 120ms ease;
  overflow: hidden;
}

.trade-button:focus-visible{
  color: #ffffff;
  background:
    linear-gradient(180deg, rgba(24, 40, 68, 0.99), rgba(16, 31, 56, 0.99)) padding-box,
    linear-gradient(
      135deg,
      #87dfff 0%,
      #4ab8ff 50%,
      #1d68b4 100%
    ) border-box;
  filter: brightness(1.08) saturate(1.04);
}

@media (hover: hover) and (pointer: fine) {
  .trade-button:hover {
    color: #ffffff;
    background:
      linear-gradient(180deg, rgba(24, 40, 68, 0.99), rgba(16, 31, 56, 0.99)) padding-box,
      linear-gradient(
        135deg,
        #87dfff 0%,
        #4ab8ff 50%,
        #1d68b4 100%
      ) border-box;
    filter: brightness(1.08) saturate(1.04);
  }
}

.trade-button:focus-visible {
  outline: none;
}

.trade-button:active{
  filter: brightness(0.96);
}
