/* =========================================================
   Pyramid PvE Wiki (page styles)
   - Mobile-first
   - Uses shared tokens from ../shared/base.css
   ========================================================= */

:root{
  --pve-max: 1120px;
  --pve-pad: 12px;

  --card: rgba(34,36,58,.55);
  --card2: rgba(43,47,73,.55);
  --cardBorder: 1px solid rgba(255,255,255,.10);

  --pillBg: rgba(255,255,255,.06);
  --pillBorder: 1px solid rgba(255,255,255,.10);

  --thumbBg:
    radial-gradient(260px 160px at 30% 20%, rgba(124,92,255,.18), transparent 60%),
    radial-gradient(260px 160px at 70% 20%, rgba(53,198,255,.12), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
}

[hidden]{
  display: none !important;
}

.pveShell{
  width: min(var(--pve-max), 100%);
  margin: 0 auto;
  padding: 12px var(--pve-pad) 24px;
}

@media (min-width: 560px){
  :root{ --pve-pad: 14px; }
  .pveShell{ padding-top: 14px; }
}
@media (min-width: 900px){
  :root{ --pve-pad: 18px; }
  .pveShell{ padding-top: 16px; }
}

/* =========================================================
   Hero
   ========================================================= */
.pveHero{
  display: grid;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

.pveHeroText{ min-width: 0; }

.pveH1{
  margin: 0 0 4px;
  font-size: 20px;
  letter-spacing: .2px;
}

.pveLead{
  margin: 0;
  color: rgba(255,255,255,.75);
  font-size: 13px;
  line-height: 1.35;
}
.pveLead b{ color: rgba(255,255,255,.92); }
.pveLead .dot{ opacity: .6; padding: 0 6px; }

.pveHeroTip{
  border: var(--cardBorder);
  border-radius: 16px;
  background: rgba(255,255,255,.04);
  padding: 10px 12px;
}
.tipTitle{
  font-weight: 950;
  letter-spacing: .2px;
  font-size: 12px;
}
.tipBody{
  margin-top: 4px;
  color: rgba(255,255,255,.72);
  font-size: 12px;
  line-height: 1.3;
}

@media (min-width: 860px){
  .pveHero{
    grid-template-columns: 1.3fr .7fr;
    align-items: center;
    margin-bottom: 14px;
  }
  .pveH1{ font-size: 22px; }
}

/* =========================================================
   Controls
   ========================================================= */
.pveControls{
  border: var(--cardBorder);
  border-radius: 18px;
  background: rgba(34,36,58,.35);
  box-shadow: 0 10px 26px rgba(0,0,0,.18);
  padding: 12px;
  /* position: sticky; */
  top: 62px; /* below .topbar */
  z-index: 20;
  backdrop-filter: blur(10px);
}

.searchRow{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.searchInput{
  width: 100%;
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.92);
  padding: 10px 12px;
  outline: none;
  font-weight: 700;
}
.searchInput::placeholder{ color: rgba(255,255,255,.55); }
.searchInput:focus{
  box-shadow: 0 0 0 4px rgba(124,92,255,.18);
  border-color: rgba(124,92,255,.35);
}

.btn.small{
  padding: 10px 12px;
  border-radius: 14px;
}

.chipsRow{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.pill{
  display: inline-flex;
  align-items: center;
  gap: 8px;

  padding: 8px 10px;
  border-radius: 999px;
  border: var(--pillBorder);
  background: var(--pillBg);
  cursor: pointer;

  font-weight: 900;
  font-size: 12px;
  color: rgba(255,255,255,.88);
  user-select: none;

  transition: transform .08s ease, background .2s ease, border-color .2s ease;
}
.pill:hover{
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.16);
}
.pill:active{ transform: translateY(1px); }

.pill.active{
  border-color: rgba(124,92,255,.35);
  background: rgba(124,92,255,.14);
}

.pillDot{
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.30);
  box-shadow: 0 0 0 4px rgba(255,255,255,.05);
}
.pill.active .pillDot{
  background: var(--accent, #7c5cff);
  box-shadow: 0 0 0 4px rgba(124,92,255,.18);
}

.metaRow{
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.metaLeft{
  color: rgba(255,255,255,.68);
  font-size: 12px;
}
.metaRight{ display:flex; gap: 8px; }

@media (min-width: 900px){
  .pveControls{
    top: 68px;
    padding: 14px;
  }
}

/* =========================================================
   Results grid
   ========================================================= */
.pveGridWrap{ margin-top: 12px; }

.pveGrid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 640px){
  .pveGrid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 980px){
  .pveGrid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* =========================================================
   Card (entity / item / reward)
   ========================================================= */
.card{
  border: var(--cardBorder);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 10px 26px rgba(0,0,0,.16);
  overflow: hidden;
  min-width: 0;
  cursor: pointer;
  transition: transform .08s ease, border-color .2s ease, background .2s ease;
}
.card:hover{
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.16);
  background: rgba(43,47,73,.50);
}
.card:active{ transform: translateY(0px); }

.cardTop{
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  padding: 12px;
  align-items: center;
}

.thumb{
  width: 92px;
  height: 92px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: var(--thumbBg);
  display: grid;
  place-items: center;
  overflow: hidden;

  /* NEW: tuning vars */
  --fit: contain;    /* contain | cover */
  --zoom: 1;         /* 0.8 smaller / 1.15 bigger */
  --posX: 50%;
  --posY: 50%;
}

.thumb img{
  width: 100%;
  height: 100%;

  /* NEW: controlled by vars */
  object-fit: var(--fit);
  object-position: var(--posX) var(--posY);

  transform: scale(var(--zoom));
  transform-origin: var(--posX) var(--posY);

  image-rendering: pixelated;
}

/* IMPORTANT: change from ".thumb.cover img { object-fit: cover }" */
.thumb.cover{ --fit: cover; }

.thumb.noPixel img{ image-rendering: auto; }

/* NEW: presets */
.thumb.mode-sprite{ --fit: contain; --zoom: 1.08; }
.thumb.mode-scene{  --fit: cover;   --zoom: 1.02; }
.thumb.mode-mini{   --fit: contain; --zoom: .82; }

.cardTitleRow{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.cardTitle{
  font-weight: 950;
  letter-spacing: .2px;
  margin: 0;
  font-size: 14px;
  line-height: 1.15;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cardSub{
  margin-top: 4px;
  color: rgba(255,255,255,.68);
  font-size: 12px;
  line-height: 1.2;
}

.badge{
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 950;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.9);
}

.cardBody{
  padding: 0 12px 12px;
}

.kv{
  display:grid;
  grid-template-columns: 92px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid rgba(255,255,255,.06);
}
.kv:first-of-type{ border-top: 0; }
.kvKey{
  color: rgba(255,255,255,.58);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .25px;
}
.kvVal{
  color: rgba(255,255,255,.88);
  font-size: 12px;
  font-weight: 750;
  min-width: 0;
}

.dropList{
  margin-top: 8px;
  display: grid;
  gap: 6px;
}
.dropRow{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
}
.dropIcon{
  width: 18px;
  height: 18px;
  object-fit: contain;
  image-rendering: pixelated;
  flex: 0 0 auto;
}
.dropName{
  font-size: 12px;
  font-weight: 850;
  color: rgba(255,255,255,.88);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dropMeta{
  margin-left: auto;
  display:flex;
  align-items:center;
  gap: 8px;
  flex: 0 0 auto;
}
.amount{
  font-size: 11px;
  font-weight: 900;
  color: rgba(255,255,255,.72);
}

/* Rarity pills */
.rarity{
  font-size: 10px;
  font-weight: 950;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.9);
  text-transform: uppercase;
  letter-spacing: .25px;
}

.rarity[data-r="common"]{ background: rgba(255,255,255,.05); }
.rarity[data-r="uncommon"]{ background: rgba(45,227,142,.10); border-color: rgba(45,227,142,.22); }
.rarity[data-r="rare"]{ background: rgba(53,198,255,.10); border-color: rgba(53,198,255,.22); }
.rarity[data-r="very_rare"]{ background: rgba(124,92,255,.14); border-color: rgba(124,92,255,.26); }
.rarity[data-r="ultra_rare"]{ background: rgba(255,211,105,.12); border-color: rgba(255,211,105,.24); }
.rarity[data-r="legendary"]{ background: rgba(255,120,120,.12); border-color: rgba(255,120,120,.22); }
.rarity[data-r="rarest"]{ background: rgba(255,120,120,.20); border-color: rgba(255,120,120,.32); }

/* Compact toggle */
.pveShell.compact .cardTop{ grid-template-columns: 72px 1fr; }
.pveShell.compact .thumb{ width: 72px; height: 72px; border-radius: 14px; }
.pveShell.compact .kv{ grid-template-columns: 78px 1fr; }
.pveShell.compact .dropRow{ padding: 5px 7px; }

/* =========================================================
   Modal
   ========================================================= */
.modalOverlay{
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  padding: 12px;
}
/* Fix: respect the HTML [hidden] attribute */
.modalOverlay[hidden]{
  display: none !important;
}

.modalCard{
  width: min(860px, 100%);
  max-height: min(86vh, 860px);
  overflow: auto;

  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(20,21,38,.92);
  box-shadow: 0 18px 60px rgba(0,0,0,.45);
  padding: 14px;
  position: relative;
}

.modalClose{
  position: sticky;
  top: 0;
  float: right;
  z-index: 2;
  margin-left: auto;
}

.modalHead{
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 14px;
  align-items: center;
  margin-top: 8px;
}

.modalThumb{
  width: 110px;
  height: 110px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.12);
  background: var(--thumbBg);
  display:grid;
  place-items:center;
  overflow:hidden;

  /* NEW: tuning vars */
  --fit: contain;
  --zoom: 1;
  --posX: 50%;
  --posY: 50%;
}

.modalThumb img{
  width:100%;
  height:100%;

  object-fit: var(--fit);
  object-position: var(--posX) var(--posY);

  transform: scale(var(--zoom));
  transform-origin: var(--posX) var(--posY);

  image-rendering: pixelated;
}

/* IMPORTANT: change from ".modalThumb.cover img { object-fit: cover }" */
.modalThumb.cover{ --fit: cover; }

.modalThumb.noPixel img{ image-rendering: auto; }

/* NEW: presets */
.modalThumb.mode-sprite{ --fit: contain; --zoom: 1.08; }
.modalThumb.mode-scene{  --fit: cover;   --zoom: 1.02; }
.modalThumb.mode-mini{   --fit: contain; --zoom: .82; }

.modalTitleRow{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 12px;
}
.modalTitle{
  margin: 0;
  font-size: 18px;
  font-weight: 980;
  letter-spacing: .2px;
  line-height: 1.1;
}
.modalSubtitle{
  margin-top: 6px;
  color: rgba(255,255,255,.70);
  font-size: 13px;
  line-height: 1.3;
}

.section{
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sectionTitle{
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .25px;
  text-transform: uppercase;
  color: rgba(255,255,255,.72);
  margin-bottom: 8px;
}

.noteBox{
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  border-radius: 14px;
  padding: 10px 12px;
  color: rgba(255,255,255,.78);
  font-size: 13px;
  line-height: 1.35;
}
.noteBox + .noteBox{ margin-top: 8px; }

.sourceList{
  display: grid;
  gap: 8px;
}
.sourceItem{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  cursor:pointer;
}
.sourceItem:hover{
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.16);
}
.sourceLeft{ min-width: 0; }
.sourceName{
  font-weight: 950;
  font-size: 13px;
  line-height: 1.1;
}
.sourceSub{
  margin-top: 4px;
  color: rgba(255,255,255,.64);
  font-size: 12px;
  line-height: 1.2;
}
.sourceRight{ margin-left: auto; display:flex; gap: 8px; align-items:center; }

/* a11y helpers */
.srOnly{
  position:absolute;
  width:1px;height:1px;
  padding:0;margin:-1px;
  overflow:hidden;clip:rect(0,0,0,0);
  white-space:nowrap;border:0;
}

