/* Inventory page */
.inv-meta {
  margin-bottom: 12px;
  color: var(--portal-muted);
  font-size: 14px;
}

.inv-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.inv-section-title {
  margin: 14px 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--portal-gold);
}

.inv-grid {
  display: grid;
  gap: 6px;
}

.inv-grid--armor {
  grid-template-columns: repeat(4, 56px);
}

.inv-grid--offhand {
  grid-template-columns: 56px;
}

.inv-grid--main {
  grid-template-columns: repeat(9, minmax(0, 56px));
}

.inv-grid--hotbar {
  grid-template-columns: repeat(9, minmax(0, 56px));
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--portal-line);
}

.inv-grid--flat {
  grid-template-columns: repeat(9, minmax(0, 56px));
}

.inv-slot {
  position: relative;
  box-sizing: border-box;
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1px solid rgba(61, 222, 168, 0.2);
  background:
    linear-gradient(145deg, rgba(30, 40, 58, 0.9), rgba(12, 16, 28, 0.95));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.inv-slot:disabled,
.inv-slot.empty {
  opacity: 0.45;
  cursor: default;
}

.inv-slot:not(:disabled):hover {
  border-color: rgba(61, 222, 168, 0.55);
}

.inv-slot img {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  pointer-events: none;
}

.inv-label {
  display: none;
  font-size: 9px;
  line-height: 1.1;
  text-align: center;
  padding: 2px;
  color: var(--portal-ink);
  word-break: break-word;
}

.inv-label.is-visible {
  display: block;
}

.inv-slot .qty {
  position: absolute;
  right: 3px;
  bottom: 2px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px #000;
  pointer-events: none;
}

.inv-menu {
  position: fixed;
  z-index: 12050;
  min-width: 168px;
  max-width: min(260px, calc(100vw - 24px));
  max-height: 240px;
  overflow: auto;
  background: #141820;
  border: 1px solid rgba(61, 222, 168, 0.35);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  padding: 4px 0;
}

.inv-menu-title {
  padding: 8px 12px 4px;
  font-size: 11px;
  color: var(--portal-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.inv-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--portal-ink);
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.inv-menu-item:hover {
  background: rgba(61, 222, 168, 0.12);
}

.inv-menu-item--primary {
  color: var(--portal-accent);
  font-weight: 700;
}

.inv-menu-empty {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--portal-muted);
}

.inv-menu--amount {
  max-height: none;
  min-width: 200px;
}

.inv-amount-row {
  display: flex;
  gap: 8px;
  padding: 4px 12px 8px;
  align-items: center;
}

.inv-amount-input {
  width: 72px;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid var(--portal-line);
  border-radius: 6px;
  background: #0c101c;
  color: var(--portal-ink);
  font: inherit;
}

.inv-amount-all {
  border: 1px solid var(--portal-line);
  background: transparent;
  color: var(--portal-ink);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

#inv-error.is-ok {
  color: #6c6;
}

@media (max-width: 640px) {
  .inv-grid--armor,
  .inv-grid--main,
  .inv-grid--hotbar,
  .inv-grid--flat {
    grid-template-columns: repeat(9, minmax(0, 1fr));
    gap: 4px;
  }
  .inv-grid .inv-slot {
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1;
  }
  .inv-grid .inv-slot img {
    width: 70%;
    height: 70%;
    max-width: 36px;
    max-height: 36px;
  }
  /* Paperdoll slots must stay square — never inherit grid stretch */
  .inv-doll__slot.inv-slot {
    width: 40px !important;
    height: 40px !important;
    max-width: 40px !important;
    aspect-ratio: auto !important;
    flex: none !important;
  }
  .inv-doll__slot.inv-slot img {
    width: 28px !important;
    height: 28px !important;
    max-width: 28px;
    max-height: 28px;
  }
}

.inv-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 260px);
  gap: 1.5rem;
  align-items: start;
  justify-items: center;
}

.inv-bags {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

.inv-grid--main,
.inv-grid--hotbar,
.inv-grid--flat {
  justify-content: center;
}

.inv-doll {
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  text-align: center;
}

.inv-doll__nick {
  margin: 0 0 0.65rem;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--portal-accent);
}

.inv-doll__figure {
  position: relative;
  width: 240px;
  height: 340px;
  margin: 0 auto;
}

.inv-doll__silhouette {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  transform: translateX(-50%);
  width: 168px;
  height: 100%;
  border-radius: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  background-image: url("images/portal/character.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center center;
  image-rendering: pixelated;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.45));
  z-index: 1;
  pointer-events: none;
}

.inv-doll__silhouette::before {
  display: none;
}

.inv-doll__slot {
  position: absolute !important;
  z-index: 2;
}

/* Align slots to head / chest / legs / boots (% scales with figure) */
.inv-doll__slot--helm {
  left: 50%;
  top: 2.8%;
  transform: translateX(-50%);
}
.inv-doll__slot--chest {
  left: 50%;
  top: 27%;
  transform: translateX(-50%);
}
.inv-doll__slot--legs {
  left: 50%;
  top: 51%;
  transform: translateX(-50%);
}
.inv-doll__slot--boots {
  left: 50%;
  top: 75%;
  transform: translateX(-50%);
}
.inv-doll__slot--off {
  left: 3%;
  top: 27%;
  transform: none;
}

.inv-doll__hint {
  display: none !important;
}

@media (max-width: 820px) {
  .inv-layout {
    grid-template-columns: 1fr;
  }
  .inv-doll {
    order: -1;
    width: 100%;
    max-width: 220px;
    margin: 0 auto;
  }
  .inv-doll__figure {
    width: 160px;
    height: 236px;
  }
  .inv-doll__silhouette {
    width: 108px;
  }
  .inv-doll__slot.inv-slot {
    width: 40px !important;
    height: 40px !important;
    aspect-ratio: auto !important;
  }
  .inv-doll__slot img {
    width: 28px;
    height: 28px;
  }
}

.inv-rewards {
  display: grid;
  gap: 1rem;
  margin: 0 0 1.5rem;
}

.inv-reward-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  border: 1px solid rgba(61, 222, 168, 0.22);
  background: linear-gradient(145deg, rgba(22, 30, 44, 0.95), rgba(12, 16, 26, 0.98));
  min-width: 0;
  overflow: hidden;
}

.inv-reward-card > .portal-btn {
  align-self: flex-start;
  width: auto;
  max-width: 100%;
}

.inv-reward-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  margin-bottom: 0.75rem;
}

.inv-reward-card__head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.inv-reward-card__hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--portal-muted);
}

.inv-reward-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 0.85rem;
}

.inv-reward-preview--compact {
  margin-bottom: 0.55rem;
}

.inv-reward-item {
  position: relative;
  box-sizing: border-box;
  width: 64px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.inv-reward-item__icon {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  border: 1px solid rgba(61, 222, 168, 0.28);
  background:
    linear-gradient(145deg, rgba(36, 48, 64, 0.95), rgba(10, 14, 22, 0.98));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.inv-reward-item img {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.inv-reward-item .inv-label {
  font-size: 8px;
  padding: 2px;
  line-height: 1.1;
  text-align: center;
}

.inv-reward-item .qty {
  position: absolute;
  right: 3px;
  bottom: 2px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px #000;
}

.inv-reward-item__name {
  display: block;
  width: 100%;
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  color: var(--portal-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inv-reward-preview--compact .inv-reward-item {
  width: 56px;
}

.inv-reward-preview--compact .inv-reward-item__icon {
  width: 44px;
  height: 44px;
}

.inv-reward-preview--compact .inv-reward-item img {
  width: 32px;
  height: 32px;
}

.inv-reward-preview--compact .inv-reward-item__name {
  font-size: 9px;
}

.inv-hour-path,
.inv-hour-grid {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.85rem;
  overflow-x: auto;
  padding: 0.25rem 0;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
}

.inv-hour-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  flex: 0 0 auto;
  min-width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: rgba(240, 180, 41, 0.12);
  border: 1px solid rgba(240, 180, 41, 0.35);
  color: var(--portal-gold);
  font-size: 1.25rem;
  font-weight: 800;
  user-select: none;
}

.inv-hour-arrow span {
  line-height: 1;
}

.inv-hour-card {
  flex: 0 0 auto;
  width: 200px;
  max-width: 200px;
  min-width: 0;
  padding: 0.75rem 0.65rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  text-align: center;
  box-sizing: border-box;
}

.inv-hour-empty {
  margin: 0;
  color: var(--portal-muted);
  text-align: center;
  width: 100%;
}

.inv-hour-card__wait {
  margin: 0;
  font-size: 0.75rem;
  color: var(--portal-muted);
}

.inv-hour-card--claimable {
  border-color: rgba(61, 222, 168, 0.25);
  background: rgba(61, 222, 168, 0.04);
}

.inv-hour-card.is-active {
  border-color: rgba(61, 222, 168, 0.55);
  background: rgba(61, 222, 168, 0.12);
  box-shadow: 0 0 0 1px rgba(61, 222, 168, 0.2);
}

.inv-hour-card--claimed {
  opacity: 0.75;
}

.inv-hour-card--locked {
  opacity: 0.5;
}

.inv-hour-card__title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 800;
}

.inv-hour-card__money {
  margin: 0;
  font-size: 0.8rem;
  color: var(--portal-gold);
  font-weight: 700;
}

.inv-hour-mystery {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  min-height: 40px;
  align-items: center;
}

.inv-hour-mystery__slot {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px dashed rgba(240, 180, 41, 0.45);
  background:
    linear-gradient(145deg, rgba(40, 36, 20, 0.9), rgba(12, 14, 20, 0.95));
  color: var(--portal-gold);
  font-weight: 800;
  font-size: 1.25rem;
  line-height: 40px;
  text-align: center;
  user-select: none;
}

.inv-hour-mystery__slot.is-claimed {
  border-style: solid;
  border-color: rgba(61, 222, 168, 0.45);
  color: var(--portal-accent);
  background: rgba(61, 222, 168, 0.12);
}

.inv-hour-card__btn {
  margin-top: auto;
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
}

.inv-hour-card.is-active .inv-reward-preview--compact {
  justify-content: center;
}

.inv-drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(4, 6, 12, 0.82);
  backdrop-filter: blur(8px);
}

.inv-drop-overlay__card {
  width: min(420px, 100%);
  padding: 1.75rem 1.5rem;
  border-radius: 18px;
  border: 1px solid rgba(61, 222, 168, 0.4);
  background: linear-gradient(160deg, #141c28, #0a1018);
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

.inv-drop-overlay__kicker {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--portal-muted);
}

.inv-drop-overlay__card h2 {
  margin: 0 0 1rem;
  font-size: 1.35rem;
}

.inv-drop-overlay__cmd {
  margin: 0 0 0.75rem;
}

.inv-drop-overlay__cmd code {
  display: inline-block;
  padding: 0.7rem 1.1rem;
  border-radius: 10px;
  font-family: "Press Start 2P", monospace;
  font-size: 1rem;
  color: #061018;
  background: linear-gradient(135deg, var(--portal-accent), #f0b429);
}

.inv-drop-overlay__note {
  margin: 0 0 1.25rem;
  color: var(--portal-muted);
  font-size: 0.9rem;
}

.inv-drop-overlay__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}

body.inv-drop-open {
  overflow: hidden;
}

/* —— Mobile rewards / paperdoll polish —— */
@media (max-width: 640px) {
  .inv-rewards {
    gap: 0.75rem;
    margin-bottom: 1.1rem;
  }

  .inv-reward-card {
    padding: 0.75rem 0.8rem;
    border-radius: 12px;
  }

  .inv-reward-card__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    margin-bottom: 0.55rem;
  }

  .inv-reward-card__head h3 {
    font-size: 0.95rem;
  }

  .inv-reward-card__hint {
    font-size: 0.72rem;
    line-height: 1.35;
  }

  .inv-reward-preview {
    gap: 5px;
    margin-bottom: 0.65rem;
  }

  .inv-reward-item {
    width: 48px;
  }

  .inv-reward-item__icon {
    width: 44px;
    height: 44px;
    border-radius: 8px;
  }

  .inv-reward-item img {
    width: 32px;
    height: 32px;
  }

  .inv-reward-item__name {
    font-size: 9px;
  }

  .inv-reward-preview--compact .inv-reward-item {
    width: 44px;
  }

  .inv-reward-preview--compact .inv-reward-item__icon {
    width: 40px;
    height: 40px;
  }

  .inv-reward-preview--compact .inv-reward-item img {
    width: 28px;
    height: 28px;
  }

  .inv-hour-path,
  .inv-hour-grid {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.55rem;
    overflow-x: visible;
    overflow-y: visible;
  }

  .inv-hour-card {
    width: 100%;
    max-width: 280px;
    flex: 0 0 auto;
  }

  .inv-hour-arrow {
    min-width: 1.75rem;
    height: 1.75rem;
    font-size: 1rem;
    transform: rotate(90deg);
  }

  .inv-hour-mystery__slot {
    width: 36px;
    height: 36px;
    line-height: 36px;
    font-size: 1.1rem;
  }

  .inv-hour-card__btn {
    width: auto;
    min-width: 7.5rem;
    max-width: 100%;
  }

  .inv-reward-card > .portal-btn {
    width: 100%;
    max-width: 280px;
    align-self: center;
  }

  .inv-doll {
    max-width: 180px;
  }

  .inv-doll__figure {
    width: 148px;
    height: 218px;
  }

  .inv-doll__silhouette {
    width: 100px;
  }

  .inv-doll__slot.inv-slot {
    width: 36px !important;
    height: 36px !important;
  }

  .inv-doll__slot.inv-slot img {
    width: 26px !important;
    height: 26px !important;
  }
}

