#pfd-wrapper {
  font-family: Arial, sans-serif;
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px;
  box-sizing: border-box;
}

/* Controls */
#pfd-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: center;
}

#pfd-search {
  flex: 1;
  min-width: 160px;
  padding: 9px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
}

#pfd-type,
#pfd-sort {
  padding: 9px 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  cursor: pointer;
}

#pfd-count {
  font-size: 13px;
  color: #888;
  white-space: nowrap;
}

/* Loading */
#pfd-loading {
  text-align: center;
  padding: 40px;
  font-size: 15px;
  color: #888;
}

/* Grid */
.pfd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}

/* Card */
.pfd-card {
  background: #fff;
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 2px solid transparent;
}

.pfd-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.13);
  border-color: #9c27b0;
}

.pfd-card img {
  width: 80px;
  height: 80px;
  display: block;
  margin: 0 auto 6px;
}

.pfd-card .pfd-id {
  font-size: 11px;
  color: #aaa;
  margin-bottom: 2px;
}

.pfd-card .pfd-name {
  font-weight: bold;
  font-size: 13px;
  text-transform: capitalize;
  color: #333;
  margin-bottom: 6px;
}

.pfd-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  margin: 2px;
  text-transform: capitalize;
  font-weight: 500;
}

/* Type colours */
.pfd-tag.normal   { background: #d4d4d4; color: #555; }
.pfd-tag.fire     { background: #ff7043; color: #fff; }
.pfd-tag.water    { background: #29b6f6; color: #fff; }
.pfd-tag.grass    { background: #66bb6a; color: #fff; }
.pfd-tag.electric { background: #ffca28; color: #555; }
.pfd-tag.ice      { background: #80deea; color: #555; }
.pfd-tag.fighting { background: #ef5350; color: #fff; }
.pfd-tag.poison   { background: #ab47bc; color: #fff; }
.pfd-tag.ground   { background: #ffb74d; color: #555; }
.pfd-tag.flying   { background: #90caf9; color: #555; }
.pfd-tag.psychic  { background: #ec407a; color: #fff; }
.pfd-tag.bug      { background: #aed581; color: #555; }
.pfd-tag.rock     { background: #a1887f; color: #fff; }
.pfd-tag.ghost    { background: #7e57c2; color: #fff; }
.pfd-tag.dragon   { background: #5c6bc0; color: #fff; }
.pfd-tag.dark     { background: #546e7a; color: #fff; }
.pfd-tag.steel    { background: #90a4ae; color: #fff; }
.pfd-tag.fairy    { background: #f48fb1; color: #fff; }

/* Modal overlay */
#pfd-modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.55);
  z-index: 99999;
  align-items: center;
  justify-content: center;
}

#pfd-modal.open {
  display: flex;
}

#pfd-modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  width: 380px;
  max-width: 92%;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
}

#pfd-modal-close {
  position: absolute;
  top: 12px; right: 14px;
  background: #f5f5f5;
  border: none;
  border-radius: 50%;
  width: 32px; height: 32px;
  font-size: 16px;
  cursor: pointer;
  line-height: 32px;
  text-align: center;
  padding: 0;
}
#pfd-modal-close:hover { background: #ffcdd2; }

#pfd-modal-data h2 {
  text-transform: capitalize;
  margin: 0 0 8px;
  color: #333;
}

#pfd-modal-data img {
  display: block;
  width: 120px;
  height: 120px;
  margin: 0 auto 12px;
}

.pfd-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
}

.pfd-stat-bar-wrap {
  flex: 1;
  margin: 0 10px;
  background: #eee;
  border-radius: 4px;
  height: 10px;
  align-self: center;
}

.pfd-stat-bar {
  height: 10px;
  border-radius: 4px;
  background: #6a5acd;
}

/* Responsive */
@media (max-width: 600px) {
  .pfd-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
  }
  #pfd-controls { flex-direction: column; }
  #pfd-search { width: 100%; }
}
