/* =============================================================================
   Pet Stats view — INLINE section in the hub (not a lightbox). Revealed below
   the hub content; the hub scrolls down to it when the Stats button is tapped.
   CORE STATS grid + ADDITIONAL STATS list. Reads the live values pet-hub.js
   already writes into the hidden stat panel (green +bonus = gear contribution).
   Icons: assets/images/pet-hub/stats/
   ========================================================================== */

/* inline section that fills the screen when open; the hub scrolls down to it. */
.inv-pet-hub.is-stats-open { overflow-y: auto; overflow-x: hidden; }
/* keep the mobile bottom tab bar pinned at the bottom while the stats scroll */
.inv-pet-hub.is-stats-open .inv-hub-tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9800; }
#inv-stats-section { flex-shrink: 0; }
#inv-stats-section[hidden] { display: none; }

.inv-psv {
	position: relative; z-index: 11; width: 100%; box-sizing: border-box;
	min-height: 100vh; min-height: 100dvh;   /* fills the screen so the scroll panel above isn't visible */
	display: flex; flex-direction: column; justify-content: center; align-items: center;  /* centre the box vertically */
	padding: 10px clamp(8px, 2vw, 22px) calc(74px + env(safe-area-inset-bottom,0px));  /* room for the pinned tab bar */
	font-family: Rajdhani, sans-serif; color: #e7e3d2;
	/* keep the original game scene (not flat black), darkened for readability (per Enes) */
	background:
		linear-gradient(180deg, rgba(4,6,15,.74), rgba(4,6,15,.88)),
		url(../images/pet-hub-bg.webp) center 38% / cover no-repeat;
}
/* ONE gold-framed box holding both sections (CORE + ADDITIONAL). */
.inv-psv__wrap {
	position: relative; width: 100%; max-width: 760px; margin: 0 auto;
	border: clamp(10px, 2vw, 18px) solid transparent;
	border-image: url(../images/pet-hub/scroll/frame-9slice.png) 120 fill stretch;
	padding: clamp(3px, .9vw, 9px) clamp(6px, 1.2vw, 14px) clamp(5px, .9vw, 11px);
}
.inv-psv__block { padding: clamp(2px, .5vw, 5px) 2px; }
/* first header sits below the corner close button, so both chevrons line up at the right edge */
.inv-psv__block:first-of-type { margin-top: clamp(22px, 3vw, 30px); }
/* divider between the two sections inside the single box */
.inv-psv__block--2 {
	margin-top: clamp(5px, 1.1vw, 11px); padding-top: clamp(7px, 1.3vw, 13px);
	border-top: 1px solid rgba(231,184,78,.2);
}

.inv-psv__head { display: flex; align-items: center; gap: 7px; margin: 0 0 7px; padding: 5px 8px; cursor: pointer;
	-webkit-tap-highlight-color: transparent; border-radius: 8px;
	background: linear-gradient(90deg, rgba(231,184,78,.14), rgba(231,184,78,.03) 55%, transparent);
	box-shadow: inset 0 0 0 1px rgba(231,184,78,.16); }
.inv-psv__head-icon { width: clamp(16px, 3.2vw, 23px); height: clamp(16px, 3.2vw, 23px); object-fit: contain;
	flex-shrink: 0; filter: drop-shadow(0 0 7px rgba(231,184,78,.5)); }
.inv-psv__head-title { flex: 1; font-weight: 800; font-size: clamp(.76rem, 1.5vw, .98rem); letter-spacing: .06em;
	text-transform: uppercase; color: #fdf4d9; }
.inv-psv__chev { flex-shrink: 0; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
	border-radius: 6px; font-size: .66rem; color: #cbd3ea; transition: transform .2s;
	background: rgba(6,9,22,.6); border: 1px solid rgba(231,184,78,.35); }
.inv-psv__head-close {
	position: absolute; top: 2px; right: 2px; z-index: 6; width: 24px; height: 24px; cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center; border-radius: 6px;
	color: #cbd3ea; background: rgba(6,9,22,.7); border: 1px solid rgba(231,184,78,.4);
	font-size: .85rem; line-height: 1;
}
.inv-psv__head-close:hover { background: rgba(231,184,78,.16); color: #fff; }

/* accordion collapse */
.inv-psv__block.is-collapsed .inv-psv__body { display: none; }
.inv-psv__block.is-collapsed .inv-psv__chev { transform: rotate(-90deg); }

/* keep the Play door from poking over the stats section on desktop */
.inv-pet-hub.is-stats-open .inv-pet-hub__door-glow { display: none !important; }

/* CORE grid */
/* read-only rows, not button-cards: flat, hairline separators, tight */
.inv-psv__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 clamp(8px, 1.6vw, 18px); }
/* icon | label(flex) | value+bonus | chevron. Keeping value+bonus in ONE cell and
   the chevron as the last fixed track pins every chevron flush-right, whatever the
   bonus width — so they all line up (an auto bonus column used to shove them around). */
.inv-psv-card {
	display: grid; grid-template-columns: auto minmax(0, 1fr) auto 0.9em;
	align-items: center; column-gap: clamp(4px, 1vw, 7px);
	padding: clamp(2px, .5vw, 4px) clamp(2px, .6vw, 6px);
	border-bottom: 1px solid rgba(255,255,255,.05);
}
/* value + its +N bonus (or the equip CTA) travel together, right-aligned */
.inv-psv-card__vb {
	display: flex; align-items: baseline; justify-content: flex-end;
	gap: clamp(3px, .8vw, 6px); min-width: 0; white-space: nowrap;
}
.inv-psv-card__icon { width: clamp(19px, 3.6vw, 27px); height: clamp(19px, 3.6vw, 27px); object-fit: contain;
	flex-shrink: 0; filter: drop-shadow(0 0 5px var(--c, rgba(0,0,0,.4))); }
.inv-psv-card__label { min-width: 0; font-weight: 800; font-size: clamp(.6rem, 1.2vw, .78rem);
	letter-spacing: .04em; text-transform: uppercase; color: var(--c, #c4a35a);
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-psv-card__val { text-align: right; font-weight: 800; font-size: clamp(.82rem, 1.5vw, 1.05rem);
	color: #f3f6ff; white-space: nowrap; }
.inv-psv-card__bonus { text-align: right; font-weight: 800;
	font-size: clamp(.58rem, 1.2vw, .76rem); color: #4ade80; white-space: nowrap; }
.inv-psv-card__bonus--none {
	text-align: left; color: #5b6276; opacity: .85; cursor: pointer; font-weight: 600;
	font-size: clamp(.46rem, .88vw, .58rem); text-transform: lowercase; letter-spacing: .01em;
	font-style: italic; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.inv-psv-card__bonus--none:hover { color: #9aa0b8; text-decoration: underline; }
/* Phones: drop the repeated per-row "equip to boost" CTA (it ate the label, truncating
   MAGIC DEF / WISDOM / SPEED). Equipping lives on /pet-items/ and in each stat's
   tap-to-open breakdown, so the value+bonus cell carries only the real green +N here. */
@media (max-width: 640px) {
	.inv-psv-card { column-gap: clamp(3px, .8vw, 5px); }
	.inv-psv-card__bonus--none { display: none; }
}

/* ADDITIONAL list — two columns of rows */
.inv-psv__afflist { display: grid; grid-template-columns: 1fr 1fr; gap: 1px clamp(10px, 2vw, 22px); }
.inv-psv-aff {
	display: flex; align-items: center; gap: 7px; padding: 3px 4px;
	border-bottom: 1px solid rgba(255,255,255,.04);
}
.inv-psv-aff__icon { width: 17px; height: 17px; object-fit: contain; flex-shrink: 0; }
.inv-psv-aff__icon--none { opacity: 0; }
.inv-psv-aff__lbl { flex: 1; min-width: 0; font-weight: 700; font-size: clamp(.62rem, 1.3vw, .76rem);
	letter-spacing: .05em; text-transform: uppercase; color: #aeb6cc; white-space: nowrap;
	overflow: hidden; text-overflow: ellipsis; }
.inv-psv-aff__val { flex-shrink: 0; font-weight: 800; font-size: clamp(.64rem, 1.3vw, .8rem); color: #4ade80; }
/* zero rows: dim the text only — keep the icons fully visible */
.inv-psv-aff.is-zero .inv-psv-aff__lbl { color: #5b6276; }
.inv-psv-aff.is-zero .inv-psv-aff__val { color: #4b5563; }

/* ── Inline per-stat breakdown (Base / Level / Training / Items / Set → Battle) ──
   Reuses pet-hub.js's own tooltip output, shown inline instead of floating. */
.inv-psv-card--break { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.inv-psv-card__chev { width: 100%; text-align: center; font-size: .58rem;
	color: #6b7490; transition: transform .2s; }
.inv-psv-card--break.is-open { border-bottom-color: transparent; }
.inv-psv-card--break.is-open .inv-psv-card__chev { transform: rotate(180deg); color: #c4a35a; }
/* full-width expanding row directly under the tapped stat (spans both grid columns) */
.inv-psv__break {
	grid-column: 1 / -1; margin: 0 2px 7px; padding: 7px 11px;
	background: rgba(6,9,22,.55); border: 1px solid rgba(231,184,78,.16); border-radius: 8px;
	animation: inv-psv-break-in .22s ease both;
}
.inv-psv__break[hidden] { display: none; }
@keyframes inv-psv-break-in { 0% { opacity: 0; transform: translateY(-4px); } 100% { opacity: 1; transform: none; } }
.inv-psv__break .inv-pet-hub__stat-tip-row { font-family: Rajdhani, sans-serif; font-size: .76rem;
	color: #aeb6cc; white-space: normal; }
.inv-psv__break-empty { font-size: .72rem; color: #6b7490; text-align: center; }
/* keep Enes's floating tooltip invisible while we show it inline (we still read its HTML) */
.inv-pet-hub.is-stats-open .inv-pet-hub__stat-tip { display: none !important; }
@media (prefers-reduced-motion: reduce) { .inv-psv__break { animation: none; } }
