/*
 * Full Rebuild V2 — scaffold (no layout; logic lives in JS modules).
 */

/* --- Age gate: full viewport black (live visual language; no modal card) --- */
html,
body {
  margin: 0;
  min-height: 100%;
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

html:not(.pv-age-verified) {
  overflow: hidden;
  height: 100%;
}

html:not(.pv-age-verified) body {
  overflow: hidden;
  height: 100%;
}

/* Live site body stack (index.php) — gate UI uses Trebuchet only */
.pv-age-gate {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: #000;
  overflow: hidden;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", sans-serif;
  color: #fff;
}

/* Content block: max width / padding aligned to live overlay feel — no panel background */
.pv-age-gate__content {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  min-width: 0;
  overflow-x: hidden;
  /* Single dominant gap: title → EN, EN block → ES block, ES block → buttons */
  --pv-age-block-gap: 2rem;
}

/* Live #age-box h2 */
.pv-age-gate__title {
  margin: 0 0 var(--pv-age-block-gap); /* A: title → first English line */
  font-size: 28px;
  letter-spacing: 0.2px;
  text-align: center;
}

/* Live #age-box p — no vertical margin (block gaps use --pv-age-block-gap only) */
.pv-age-gate__text {
  margin: 0;
  font-size: 15px;
  text-align: center;
}

.pv-age-gate__line {
  display: block;
  width: 100%;
  max-width: none;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.68;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.pv-age-gate__line--en {
  opacity: 0.88;
}

.pv-age-gate__line--en + .pv-age-gate__line--en {
  margin-top: 0.28em;
}

/* B: English block → Spanish block (same as title gap and buttons gap) */
.pv-age-gate__line--en + .pv-age-gate__line--es {
  margin-top: var(--pv-age-block-gap);
}

.pv-age-gate__line--es {
  opacity: 0.9;
}

.pv-age-gate__line--es + .pv-age-gate__line--es {
  margin-top: 0.28em;
}

/* C: Spanish block → buttons (same as other major gaps) */
.pv-age-gate__btns {
  margin-top: var(--pv-age-block-gap);
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Live .age-btn */
.pv-age-gate__btn {
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid #333;
  cursor: pointer;
  font-size: 15px;
  min-width: 180px;
  font-family: inherit;
}

/* Live .age-btn.confirm */
.pv-age-gate__btn--confirm {
  background: #e53935;
  color: #fff;
  border-color: #e53935;
}

/* Live .age-btn.leave */
.pv-age-gate__btn--leave {
  background: #111;
  color: #bbb;
}

html.pv-age-verified .pv-age-gate {
  display: none;
}

/* Non-rebuild pages: allow body scroll. Rebuild locks the viewport (E-5A: header never scrolls away). */
html.pv-age-verified:not(.pv-layout-engine-active) body {
  overflow: auto;
}

/* E-5A: document does not scroll — logo + top bars stay in view; only #pv-shell-grid scrolls. */
html.pv-layout-engine-active.pv-age-verified,
html.pv-layout-engine-active.pv-age-verified body {
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

html.pv-layout-engine-active.pv-age-verified #pv-root {
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-sizing: border-box;
}

/* --- D-001: section shell placeholders (geometry from layout engine inline styles only) --- */
html.pv-layout-engine-active #pv-root {
  width: 100%;
  min-height: 0;
  box-sizing: border-box;
}

.pv-rebuild-shell {
  margin: 0 auto;
  overflow: hidden;
  flex: 0 0 auto;
  min-height: 0;
}

.pv-shell-row--header {
  align-items: stretch;
}

.pv-shell-main {
  align-items: stretch;
}

.pv-shell-outer {
  position: relative;
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
  background: #141820;
  border: 1px dashed #4a5568;
}

.pv-shell-outer--grid {
  border-color: #5c6b7a;
}

/* Main column (grid + pagination scroll): no outer gray shell or dashed frame — content sits on page black. */
#pv-shell-grid.pv-shell-outer--grid {
  background: transparent;
  border: none;
  box-shadow: none;
}

/* E-2-SCROLL-CONTAINER-ENFORCEMENT-V2: grid is the sole vertical scroll area for main content; engine sets height inline */
html.pv-layout-engine-active.pv-age-verified #pv-shell-grid {
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 0;
}

/* Grid column usable: transparent shell; video area (.pv-grid-video-region) has no separate tint/border. */
html.pv-layout-engine-active.pv-age-verified #pv-shell-grid .pv-shell-usable[data-pv-usable='grid'] {
  overflow: visible;
  background: transparent !important;
  border: none !important;
  box-shadow: none;
}

/* Video browse region only — no diagnostic tint/border (grid column shell stays unchanged). */
.pv-grid-video-region {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  overflow: visible;
}

/* F-2/F-3/F-4: homepage browse cards — column count from JS (--pv-rebuild-grid-cols); card shell 16:13 */
.pv-rebuild-feed-message {
  margin: 0;
  padding: 10px 12px;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", sans-serif;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.88);
}

.pv-rebuild-feed-message--error {
  color: #f6a8a8;
}

.pv-rebuild-video-grid {
  --pv-rebuild-grid-cols: 4;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(var(--pv-rebuild-grid-cols), minmax(0, 1fr));
  gap: clamp(8px, 1.2vw, 14px) clamp(8px, 1.5vw, 16px);
  padding: 10px 10px 12px;
  align-content: start;
}

.pv-rebuild-card-link {
  display: block;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.pv-rebuild-card {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  aspect-ratio: 16 / 13;
  background: #0b0b0b;
  border: 1px solid #1b1b1b;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.pv-rebuild-card:hover {
  transform: translateY(-2px);
}

.pv-rebuild-card__thumb {
  position: relative;
  flex: 13 1 0;
  min-height: 0;
  background: #111;
  overflow: hidden;
}

/* Hoverstill / preview layers — same contract as index.php .pv-thumb (load on hover via JS). */
.pv-rebuild-card__thumb .pv-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #111;
}

.pv-rebuild-card__thumb .pv-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pv-rebuild-card__thumb .pv-thumb .pv-preview-video {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.pv-rebuild-card__thumb .pv-thumb .pv-preview-video.hidden {
  visibility: hidden;
  opacity: 0;
  z-index: 0;
}

.pv-rebuild-card__thumb .pv-thumb .pv-preview-video:not(.hidden) {
  z-index: 2;
}

.pv-rebuild-card__thumb .pv-thumb img.hide-for-media {
  visibility: hidden;
  opacity: 0;
}

/* F-3: title band 3/13 of card; 2 title lines; last 15% of second line for duration (MGPV). */
.pv-rebuild-card__titleband {
  --pv-rebuild-duration-line-pct: 15%;
  flex: 3 1 0;
  min-height: 0;
  box-sizing: border-box;
  padding: 4px 8px 6px;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.pv-rebuild-card__titleblock {
  position: relative;
  align-self: center;
  width: 100%;
  min-width: 0;
  /* Match .pv-rebuild-card__title line metrics so duration aligns to second line. */
  --pv-title-lh: 1.25;
}

.pv-rebuild-card__titleblock--has-duration .pv-rebuild-card__title {
  /* Reserve the right slice of the 2-line box so text does not run under duration. */
  padding-right: var(--pv-rebuild-duration-line-pct);
  box-sizing: border-box;
}

.pv-rebuild-card__title {
  margin: 0;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", sans-serif;
  font-size: clamp(10px, 1.05vw, 12px);
  line-height: var(--pv-title-lh);
  color: rgba(255, 255, 255, 0.92);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
}

.pv-rebuild-card__duration {
  position: absolute;
  right: 0;
  /* Bottom of the 2-line clamp box — aligns to second line; width matches reserved strip. */
  bottom: 0;
  width: var(--pv-rebuild-duration-line-pct);
  max-width: var(--pv-rebuild-duration-line-pct);
  text-align: right;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", sans-serif;
  font-size: clamp(9px, 0.95vw, 11px);
  line-height: var(--pv-title-lh);
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* Reduce chained scroll; letterboxing / browser gutters stay black (not default white canvas). */
html.pv-layout-engine-active.pv-age-verified,
html.pv-layout-engine-active.pv-age-verified body {
  background-color: #000;
  overscroll-behavior-y: none;
}

#pv-shell-pagination.pv-shell-outer--pagination {
  border: none;
  background: transparent;
  box-shadow: none;
  /* margin-top: half nav bar height — set inline in applySectionShell */
}

/* F-7: Rebuild pagination — controls only; “Showing X–Y of Z” lives in #pv-topbar-feed. */
.pv-rebuild-pagination {
  box-sizing: border-box;
  width: 100%;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", sans-serif;
}

.pv-rebuild-pagination__row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  width: 100%;
  gap: 10px;
  box-sizing: border-box;
}

.pv-rebuild-pagination__controls {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 14px;
}

.pv-rebuild-pagination__arrow,
.pv-rebuild-pagination__num {
  font-size: clamp(15px, 2.1vw, 20px);
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
}

a.pv-rebuild-pagination__arrow:hover,
a.pv-rebuild-pagination__num:hover {
  color: #fff;
  text-decoration: underline;
}

.pv-rebuild-pagination__link--disabled,
.pv-rebuild-pagination__arrow.pv-rebuild-pagination__link--disabled {
  opacity: 0.38;
  cursor: default;
  pointer-events: none;
  user-select: none;
}

.pv-rebuild-pagination__nums {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
}

.pv-rebuild-pagination__num--current {
  font-weight: bold;
  text-decoration: underline;
  text-underline-offset: 2px;
  color: #fff;
}

.pv-rebuild-pagination__controls--only {
  width: 100%;
  justify-content: center;
}

.pv-rebuild-pagination--pending .pv-rebuild-pagination__pending-msg {
  font-size: clamp(15px, 2.1vw, 20px);
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.72);
}

/* Pagination band: same justified row contract as topbar ads */
#pv-shell-pagination .pv-bar-test[data-pv-nav-layout='justified'] {
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  overflow: visible;
}

#pv-shell-pagination .pv-bar-test {
  border: 1px dashed rgba(130, 140, 155, 0.8);
  background: rgba(38, 42, 52, 0.5);
}

#pv-shell-pagination .pv-nav-bar__item {
  box-sizing: border-box;
  cursor: default;
  overflow: visible;
  text-overflow: clip;
  line-height: 1;
}

/* F7-PAGINATION-AD-STRIP: reserved strip below bar (height from JS: layers × writing height) */
#pv-shell-pagination .pv-pagination-ad-strip {
  box-sizing: border-box;
  width: 100%;
  flex-shrink: 0;
  border: 1px dashed rgba(120, 110, 160, 0.5);
  background: rgba(32, 28, 42, 0.35);
}

#pv-shell-pagination .pv-pagination-flex-fill {
  min-height: 0;
  flex: 1 1 auto;
}

/* Pagination + ad strip below are part of grid scroll — always visible (no reveal-on-scroll). */

/* D-002: top bars (game / nav / ads / feed meta) — distinct tones (geometry from engine inline styles) */
.pv-shell-topbars-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* Bar spacing is engine-driven (index_rebuild_layout_engine.js) so grid math stays in sync. */

.pv-topbar-game {
  background: #1a1f2e;
  border: 1px dashed #7c6fad;
}

/* NAV bar only: pitch black — no shell border/shading; overrides .pv-shell-outer dashed diagnostic */
#pv-topbar-nav.pv-shell-outer,
#pv-topbar-nav {
  background: #000;
  border: none;
  box-shadow: none;
}

#pv-topbar-nav .pv-bar-test {
  border: none;
  background: #000;
  box-shadow: none;
}

#pv-topbar-ads .pv-bar-test {
  border: 1px dashed rgba(130, 140, 155, 0.8);
  background: rgba(38, 42, 52, 0.5);
}

/* E-5-NAVBAR-STRUCTURE-CORRECTION-011: justified row; vertical center in writing area (engine also sets alignItems). */
#pv-topbar-nav .pv-bar-test[data-pv-nav-layout='justified'],
#pv-topbar-ads .pv-bar-test[data-pv-nav-layout='justified'] {
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  overflow: visible;
}

#pv-topbar-nav .pv-nav-bar__item,
#pv-topbar-ads .pv-nav-bar__item {
  box-sizing: border-box;
  cursor: default;
  overflow: visible;
  text-overflow: clip;
  line-height: 1;
}

/* NAV item hover matches ADS (faux-bold stroke) — was explicitly disabled on NAV only. */
#pv-topbar-nav .pv-nav-bar__item:hover,
#pv-topbar-ads .pv-nav-bar__item:hover {
  text-shadow: 0.55px 0 0 currentColor, -0.55px 0 0 currentColor;
}

#pv-topbar-nav a.pv-nav-bar__item {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

/* Categories: dropdown (fixed in JS to avoid topbars overflow:hidden clipping). */
#pv-topbar-nav .pv-nav-bar__categories-wrap {
  position: relative;
  overflow: visible;
}

#pv-topbar-nav .pv-nav-bar__categories-btn {
  cursor: pointer;
}

#pv-topbar-nav .pv-nav-bar__categories-btn:hover {
  text-shadow: 0.55px 0 0 currentColor, -0.55px 0 0 currentColor;
}

/* Open panel is moved to document.body in JS so fixed positioning is viewport-anchored (above grid + bars). */
/* [hidden] must win over display:flex — otherwise the panel stays visible, blocks the Categories button, and fixed+no top/left looks “centered”. */
.pv-nav-categories-dropdown[hidden] {
  display: none !important;
  pointer-events: none !important;
}

/* Full-width layer above grid (below header row); catches taps to close categories — z-index under the panel. */
.pv-nav-categories-dismiss-layer[hidden] {
  display: none !important;
  pointer-events: none !important;
}

.pv-nav-categories-dismiss-layer:not([hidden]) {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 49999;
  pointer-events: auto;
  /* Nearly invisible: some engines skip fully transparent hit-testing. */
  background: rgba(0, 0, 0, 0.001);
  cursor: default;
  touch-action: none;
}

/* max-height when open: set in JS — at most 70% of viewport space below #pv-topbar-ads (see index_rebuild_categories_nav.js). */
.pv-nav-categories-dropdown:not([hidden]) {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-width: 14rem;
  max-width: min(92vw, 26rem);
  min-height: 0;
  padding: 0;
  margin: 0;
  position: fixed;
  z-index: 50000;
  isolation: isolate;
  background: #141414;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.55);
  font-family: 'Trebuchet MS', Arial, sans-serif;
  color: rgba(255, 255, 255, 0.92);
}

.pv-nav-categories-dropdown__scrollbtn {
  flex: 0 0 auto;
  margin: 0;
  padding: 6px 10px;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: #1e1e1e;
  color: rgba(255, 255, 255, 0.88);
  font: inherit;
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}

.pv-nav-categories-dropdown__scrollbtn:last-of-type {
  border-bottom: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.pv-nav-categories-dropdown__scrollbtn:hover,
.pv-nav-categories-dropdown__scrollbtn:focus-visible {
  background: #2a2a2a;
  color: #fff;
  outline: none;
}

.pv-nav-categories-dropdown__scroller {
  flex: 1 1 auto;
  min-height: 0;
  /* Height fills panel after ▲/▼; panel max-height from JS (70% of space below ad bar). */
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scroll-behavior: smooth;
  font-size: clamp(13px, 1.8vw, 16px);
  line-height: 1.35;
}

.pv-nav-categories-dropdown__item {
  padding: 8px 12px;
  white-space: nowrap;
  cursor: default;
  line-height: 1;
}

/* Hover matches top-bar nav items: faux-bold text stroke (no fill band). */
.pv-nav-categories-dropdown__item:hover,
.pv-nav-categories-dropdown__item:focus-visible {
  text-shadow: 0.55px 0 0 currentColor, -0.55px 0 0 currentColor;
  background: transparent;
  outline: none;
}

/* E-5-NAVBAR-SEARCH-REFINE-005: live-style red blink on Key only (color only — no layout impact) */
@keyframes pv-nav-key-blink {
  0%,
  100% {
    color: rgba(255, 255, 255, 0.92);
  }
  50% {
    color: #e53935;
  }
}

#pv-topbar-nav .pv-nav-bar__item[data-pv-nav='key'],
#pv-topbar-ads .pv-nav-bar__item[data-pv-nav='key'] {
  animation: pv-nav-key-blink 1.2s ease-in-out infinite;
}

#pv-topbar-nav .pv-nav-bar__item[data-pv-nav='key']:hover {
  animation: none;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0.55px 0 0 currentColor, -0.55px 0 0 currentColor;
}

#pv-topbar-ads .pv-nav-bar__item[data-pv-nav='key']:hover {
  animation: none;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0.55px 0 0 currentColor, -0.55px 0 0 currentColor;
}

/* Search is one flex item in the justified row; input width/min from engine (ch); arrow styled here. */
#pv-topbar-nav .pv-nav-bar__search,
#pv-topbar-ads .pv-nav-bar__search {
  display: inline-flex;
  flex-direction: row;
  box-sizing: border-box;
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
}

#pv-topbar-ads .pv-nav-bar__search {
  align-items: center;
  overflow: visible;
}

/* NAV: single red chrome around input + arrow */
#pv-topbar-nav .pv-nav-bar__search {
  align-items: stretch;
  border: 1px solid #c62828;
  border-radius: 3px;
  overflow: hidden;
}

/* E-5-NAV-WRITING-CONTRACT-01: same line-height as labels; no ellipsis; UA min-height can break vertical fit */
#pv-topbar-ads .pv-nav-bar__search-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  align-self: center;
  height: auto;
  margin: 0;
  padding: 0 calc(6px * var(--pv-ui-scale, 1));
  box-sizing: border-box;
  font-family: 'Trebuchet MS', Arial, sans-serif;
  line-height: 1;
  color: #fff;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid #c62828;
  border-radius: 3px;
  outline: none;
  overflow: hidden;
  text-overflow: clip;
}

/* NAV search: black fill inside group border (no second outer box) */
#pv-topbar-nav .pv-nav-bar__search-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  align-self: stretch;
  height: auto;
  margin: 0;
  padding: 0 calc(6px * var(--pv-ui-scale, 1));
  box-sizing: border-box;
  font-family: 'Trebuchet MS', Arial, sans-serif;
  line-height: 1;
  color: #fff;
  background: #000;
  border: none;
  border-radius: 0;
  outline: none;
  box-shadow: none;
  overflow: hidden;
  text-overflow: clip;
}

#pv-topbar-nav .pv-nav-bar__search-input::placeholder,
#pv-topbar-ads .pv-nav-bar__search-input::placeholder {
  color: #9e9e9e;
}

/* E-5-NAV-SEARCH-ARROW-DARK-02: neutral gray chrome */
#pv-topbar-ads .pv-nav-bar__search-arrow {
  flex: 0 0 auto;
  align-self: center;
  min-width: calc(1.75em * var(--pv-ui-scale, 1));
  margin: 0;
  padding: 0 calc(4px * var(--pv-ui-scale, 1));
  box-sizing: border-box;
  font: inherit;
  line-height: 1;
  color: rgba(255, 255, 255, 0.92);
  background: #212121;
  border: 1px solid #424242;
  border-radius: 3px;
  cursor: default;
}

/* NAV arrow: inside shared red box — inner divider only */
#pv-topbar-nav .pv-nav-bar__search-arrow {
  flex: 0 0 auto;
  align-self: stretch;
  min-width: calc(1.75em * var(--pv-ui-scale, 1));
  margin: 0;
  padding: 0 calc(4px * var(--pv-ui-scale, 1));
  box-sizing: border-box;
  font: inherit;
  line-height: 1;
  color: rgba(255, 255, 255, 0.92);
  background: #333333;
  border: none;
  border-left: 1px solid rgba(198, 40, 40, 0.9);
  border-radius: 0;
  box-shadow: none;
  cursor: default;
}

#pv-topbar-ads .pv-nav-bar__search-arrow:hover {
  background: #333333;
}

#pv-topbar-ads .pv-nav-bar__search-arrow:active {
  background: #141414;
}

#pv-topbar-nav .pv-nav-bar__search-arrow:hover {
  background: #404040;
}

#pv-topbar-nav .pv-nav-bar__search-arrow:active {
  background: #2a2a2a;
}

.pv-topbar-ads {
  background: #221f15;
  border: 1px solid #8a7228;
}

/* Videos showing bar: flat black like NAV — no warm/yellow tint (#221f15); ADS unchanged. */
#pv-topbar-feed.pv-shell-outer,
#pv-topbar-feed {
  box-sizing: border-box;
  background: #000;
  border: none;
  outline: none;
  box-shadow: none;
}

/* E-5-FEED-META-01: same inset as NAV/ADS — padding comes only from placeOuter (.pv-shell-usable USABLE_INSET_PX), not extra horizontal padding here (matches .pv-bar-test). */
.pv-feed-meta-bar {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  min-width: 0;
  overflow: visible;
  /* Match layoutNavBarJustifiedFlow inline stack (index_rebuild_layout_engine.js FONT_TREBUCHET). */
  font-family: "Trebuchet MS", Arial, sans-serif;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1;
}

.pv-feed-meta-bar__center {
  flex: 1 1 0;
  min-width: 0;
  box-sizing: border-box;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  text-align: left;
  line-height: 1;
  /* Font: set inline in layoutFeedMetaBar to match .pv-nav-bar__item (Trebuchet MS, Arial — not Arial Rounded MT Bold alone). */
  color: rgba(255, 255, 255, 0.92);
}

.pv-feed-meta-bar__range {
  flex: 0 1 auto;
  min-width: 0;
  box-sizing: border-box;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  text-align: right;
  line-height: 1;
  color: rgba(255, 255, 255, 0.92);
}

/* Range line hidden until progressive chunks + count complete (see index_rebuild_feed_progressive.js applyRangeLine). */
.pv-feed-meta-bar__range--pending {
  display: none;
}

/* Portrait: same contract as NAV — one row (ADS uses two rows in layoutTopBarTest; feed meta does not). */

/* Geometry truth: dotted writing box = .pv-bar-test; usable is inset-only (transparent border) */
#pv-topbar-game .pv-shell-usable,
#pv-topbar-ads .pv-shell-usable,
#pv-topbar-feed .pv-shell-usable {
  border: 1px solid transparent;
  background: transparent;
}

/* NAV only: flat black usable (no diagnostic border line) */
#pv-topbar-nav .pv-shell-usable {
  border: none;
  background: #000;
  box-shadow: none;
}

#pv-topbar-feed .pv-shell-usable {
  border: none;
  background: #000;
  box-shadow: none;
}

/* Pagination: 37.5% height is defined on this DOM node (not computed inside fit) */
#pv-shell-pagination .pv-shell-usable {
  border: 1px solid transparent;
  background: transparent;
}

.pv-pagination-writing-zone {
  box-sizing: border-box;
  width: 100%;
  min-height: 0;
  border: 1px dashed rgba(120, 110, 160, 0.55);
  background: rgba(42, 36, 58, 0.3);
  overflow: visible;
}

.pv-shell-usable {
  position: absolute;
  box-sizing: border-box;
  pointer-events: auto;
  background: rgba(20, 60, 50, 0.35);
  border: 1px dashed rgba(80, 200, 160, 0.55);
  overflow: hidden;
}

/* Logo column: pitch black — no shell/usable border line (overrides .pv-shell-outer dashed) */
#pv-shell-logo.pv-shell-outer {
  border: none;
  background: #000;
  box-shadow: none;
  outline: none;
}

/* E-1-A-FIX: hit fills usable; square sized/centered by JS; single img scales uniformly (object-fit: contain) */
.pv-shell-usable[data-pv-usable='logo'] {
  position: relative;
  display: block;
  min-width: 0;
  min-height: 0;
  border: none;
  background: #000;
  outline: none;
  box-shadow: none;
}

.pv-logo-hit-area {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  box-sizing: border-box;
  z-index: 1;
  border: none;
  outline: none;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}

.pv-logo-hit-area:hover,
.pv-logo-hit-area:focus,
.pv-logo-hit-area:focus-visible {
  text-decoration: none;
  color: inherit;
  outline: none;
  box-shadow: none;
}

.pv-logo-square {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  box-sizing: border-box;
  overflow: hidden;
  background: #000;
  border: none;
  outline: none;
  box-shadow: none;
}

.pv-logo-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  border: none;
  outline: none;
  box-shadow: none;
}

/* E-4A: top bar test layer — Trebuchet; geometry/font from layout engine JS (no fixed font-size here) */
.pv-bar-test {
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", sans-serif;
  width: 100%;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  border: 1px dashed rgba(80, 200, 160, 0.55);
  background: rgba(20, 60, 50, 0.35);
  overflow: hidden;
}

.pv-bar-test__row {
  min-height: 0;
  box-sizing: border-box;
}

.pv-bar-test__row--hidden {
  display: none !important;
}

.pv-bar-test__cell {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pv-bar-test__label {
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", sans-serif;
  color: rgba(255, 255, 255, 0.92);
  min-width: 0;
}

/* E-TIMER-01: DSEG7 Classic (local OFL) — timer clock digits + colons; labels Trebuchet white (no geometry here). */
@font-face {
  font-family: "DSEG7 Classic";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/dseg7-classic-latin-400-normal.woff2") format("woff2");
}

/* E-TIMER-11 / E-TIMER-15: clock = [clock-line outer (flex-grow)] + [captions strip] + [progress]; fit target = usable inside line. */
#pv-topbar-game .pv-game-timer-clock {
  font-variant-numeric: tabular-nums;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
}

#pv-topbar-game .pv-game-timer-clock-line-outer {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  box-sizing: border-box;
}

#pv-topbar-game .pv-game-timer-clock-line {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: center;
  min-width: 0;
  height: 100%;
  width: 100%;
  box-sizing: border-box;
}

#pv-topbar-game .pv-game-timer-captions-strip {
  flex: 0 0 0.8em;
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}

/* E-TIMER-15: no extra vertical gaps on timer subtree inside game topbar. */
#pv-topbar-game [data-pv-game-timer-root],
#pv-topbar-game [data-pv-game-timer-label],
#pv-topbar-game [data-pv-game-timer-clock],
#pv-topbar-game [data-pv-game-timer-captions-strip],
#pv-topbar-game [data-pv-game-timer-clock-line-outer],
#pv-topbar-game [data-pv-game-timer-progress-track] {
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
}

#pv-topbar-game .pv-game-timer-caption-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  box-sizing: border-box;
}

#pv-topbar-game .pv-game-timer-caption-cell--colon {
  flex: 0 0 auto;
}

#pv-topbar-game .pv-game-timer-unit {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  min-width: 0;
  flex: 0 1 auto;
  height: 100%;
  box-sizing: border-box;
}

/* E-TIMER-13: usable is the single fit/render box for digits/colon ink. */
#pv-topbar-game .pv-game-timer-usable {
  height: 100% !important;
  width: 100% !important;
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-sizing: border-box;
}

#pv-topbar-game .pv-game-timer-segment--colon {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  align-self: stretch;
  flex: 0 0 auto;
  flex-shrink: 0;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
}

#pv-topbar-game .pv-game-timer-digits,
#pv-topbar-game [data-pv-game-timer-digits].pv-game-timer-digits {
  font-family: "DSEG7 Classic", monospace !important;
  font-weight: 700;
  color: #e53935;
  min-width: 2.2ch;
  text-align: center;
  box-sizing: border-box;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
}

#pv-topbar-game .pv-game-timer-colon {
  font-family: "DSEG7 Classic", monospace !important;
  font-weight: 700;
  color: #e53935;
  line-height: 1;
  flex-shrink: 0;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
}

/* E-TIMER-19: clear debug tint overlays on ink (inline forensic may still set background-color on digits/colons). */
#pv-topbar-game .pv-game-timer-digits,
#pv-topbar-game [data-pv-game-timer-digits].pv-game-timer-digits,
#pv-topbar-game .pv-game-timer-colon {
  background: none !important;
  background-color: transparent !important;
  outline: none !important;
  box-shadow: none !important;
}

#pv-topbar-game .pv-game-timer-unit-label {
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", sans-serif;
  color: #ffffff;
  line-height: 1;
  white-space: nowrap;
  font-size: 0.63em;
  box-sizing: border-box;
}

/* E-4-B5: Awards carousel — single viewport, two stacked panes; motion from JS. */
#pv-topbar-game .pv-game-awards--carousel[data-pv-game-awards-root] {
  max-width: min(100%, 48rem);
  margin-left: auto;
  margin-right: auto;
}

#pv-topbar-game .pv-game-awards__carousel-viewport {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
}

#pv-topbar-game .pv-game-awards__pane {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

#pv-topbar-game .pv-game-awards__label,
#pv-topbar-game .pv-game-awards__amount {
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", sans-serif;
  color: #f7e94a;
  font-weight: 500;
  line-height: 1;
  text-shadow: none;
  box-shadow: none;
  background: none;
  max-width: 100%;
}

/* E-4-C2: Status — pill matches gallery vote (game_console .pv-extended-console-vote-btn); red/green only; white border; never gray button fill. */
#pv-topbar-game .pv-game-status-sta {
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  box-sizing: border-box;
}

/* E-4-C16: label band = flex container like button; inner span kills line-box inflation */
#pv-topbar-game .pv-game-status-sta__label {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  line-height: 1;
  height: auto;
  min-height: 0;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", sans-serif;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #fff;
  min-width: 0;
  box-sizing: border-box;
}

#pv-topbar-game .pv-game-status-sta__label-inner {
  display: inline-block;
  margin: 0;
  padding: 0;
  line-height: 1;
  white-space: nowrap;
  vertical-align: middle;
  box-sizing: border-box;
}

#pv-topbar-game .pv-game-status-sta__btn-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  min-height: 0;
  min-width: 0;
}

#pv-topbar-game .pv-game-status-sta__btn {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", sans-serif;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: normal;
  white-space: nowrap;
  border-radius: 999px;
  border: calc(2px * var(--pv-ui-scale, 1)) solid #fff;
  padding: calc(3px * var(--pv-ui-scale, 1)) calc(12px * var(--pv-ui-scale, 1));
  box-sizing: border-box;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: auto;
  min-width: 0;
  align-self: center;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* E-4-C24: measured text lives in inner span; pill chrome stays on button */
#pv-topbar-game .pv-game-status-sta__btn-inner {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  color: inherit;
  vertical-align: middle;
}

#pv-topbar-game .pv-game-status-sta__btn--incomplete {
  background: #c62828;
  color: #fff;
}

#pv-topbar-game .pv-game-status-sta__btn--complete {
  background: #2e7d32;
  color: #fff;
}

#pv-topbar-game .pv-game-status-sta__btn:hover {
  filter: brightness(1.05);
}

/* E-4-C32: narrow viewports — tighter horizontal padding so inner text box gains real width (NOT UPLOADED at 8px needs ~63px; proven shortfall was ~11px vs 52px inner). Desktop unchanged (rule only applies below breakpoint). */
@media (max-width: 600px) {
  #pv-topbar-game .pv-game-status-sta__btn {
    padding-left: calc(5px * var(--pv-ui-scale, 1));
    padding-right: calc(5px * var(--pv-ui-scale, 1));
  }
}

/* E-4-C18: Rank — column flex + four equal spacers; lines content-sized (font from layout engine). */
#pv-topbar-game .pv-game-rank {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  box-sizing: border-box;
}

#pv-topbar-game .pv-game-rank [data-pv-game-rank-spacer] {
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
}

#pv-topbar-game .pv-game-rank__line0,
#pv-topbar-game .pv-game-rank__line1,
#pv-topbar-game .pv-game-rank__line2 {
  display: flex;
  align-items: center;
  justify-content: center;
}

#pv-topbar-game .pv-game-rank__line0 {
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", sans-serif;
  color: rgba(255, 255, 255, 0.7);
}

#pv-topbar-game .pv-game-rank__line1 {
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", sans-serif;
}

#pv-topbar-game .pv-game-rank__rank,
#pv-topbar-game .pv-game-rank__key {
  color: #ffffff;
}

#pv-topbar-game .pv-game-rank__arrow--up {
  color: #2e7d32;
}

#pv-topbar-game .pv-game-rank__arrow--down {
  color: #c62828;
}

#pv-topbar-game .pv-game-rank__arrow--flat {
  color: #9e9e9e;
}

#pv-topbar-game .pv-game-rank__line2 {
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", sans-serif;
  color: rgba(255, 255, 255, 0.7);
}

/* F7-PAGINATION-ESCALATION-03: pagination label lives in a flex cell; global min-width:0 lets the flex item shrink below one-line intrinsic width and wrap. GAME/NAV/ADS unchanged (not under #pv-shell-pagination). */
#pv-shell-pagination .pv-bar-test__label {
  min-width: auto;
  white-space: nowrap;
}

/* F7-PAGINATION-FINAL-LINE-LOCK: absolute one-line guarantee for pagination label. */
#pv-shell-pagination .pv-bar-test__cell .pv-bar-test__label {
  min-width: max-content !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

.pv-shell-diagnostic {
  margin: 0;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", sans-serif;
  font-size: 11px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.78);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.pv-shell-outer--pagination .pv-shell-diagnostic {
  font-size: 9px;
  line-height: 1.2;
}

/* E-4-C22: GAME BAR — production visual cleanup (#pv-topbar-game only; nav/ads/grid/pagination unchanged). */
#pv-topbar-game.pv-shell-outer,
#pv-topbar-game {
  background: #000 !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

#pv-topbar-game .pv-shell-usable {
  border: 1px solid transparent !important;
  background: transparent !important;
  outline: none !important;
  box-shadow: none !important;
}

#pv-topbar-game .pv-bar-test {
  border: none !important;
  background: transparent !important;
  outline: none !important;
  box-shadow: none !important;
}

#pv-topbar-game [data-pv-game-status-module],
#pv-topbar-game .pv-bar-test__cell {
  border: none !important;
}

#pv-topbar-game,
#pv-topbar-game * {
  outline: none !important;
}

#pv-topbar-game [style*="dashed"] {
  border: none !important;
}

/* Inline diagnostic tints only — keep timer progress track/elapsed fills + status pill buttons. */
#pv-topbar-game [style*="background"]:not(.pv-game-status-sta__btn):not([data-pv-game-timer-progress-track]):not([data-pv-game-timer-progress-elapsed]) {
  background: none !important;
  background-color: transparent !important;
}

/* --- F-WATCH-01: in-grid video overlay (below header row; grid dimmed only; header/logo untouched) --- */
.pv-rebuild-watch-overlay[hidden] {
  display: none !important;
}

.pv-rebuild-watch-overlay {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45000;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.pv-rebuild-watch-overlay:not([hidden]) {
  pointer-events: auto;
}

.pv-rebuild-watch-overlay__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.pv-rebuild-watch-overlay__panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  width: 80%;
  height: 80%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.72);
  box-sizing: border-box;
  overflow: hidden;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", sans-serif;
}

.pv-rebuild-watch-overlay__close {
  position: absolute;
  top: 4px;
  right: 6px;
  z-index: 3;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.92);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}

.pv-rebuild-watch-overlay__close:hover {
  background: rgba(40, 40, 40, 0.95);
  color: #fff;
}

.pv-rebuild-watch-overlay__stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  position: relative;
}

.pv-rebuild-watch-overlay__video {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #000;
}

.pv-rebuild-watch-overlay__video[hidden] {
  display: none !important;
}

.pv-rebuild-watch-overlay__fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  box-sizing: border-box;
  background: #0b0b0b;
}

.pv-rebuild-watch-overlay__fallback[hidden] {
  display: none !important;
}

.pv-rebuild-watch-overlay__fallback img {
  max-width: 100%;
  max-height: min(56vh, 100%);
  object-fit: contain;
  border-radius: 8px;
}

.pv-rebuild-watch-overlay__fallback-msg {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.pv-rebuild-watch-overlay__title-row {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 8px 44px 10px 12px;
  background: #111;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.pv-rebuild-watch-overlay__title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  font-size: 13px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.88);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.pv-rebuild-watch-overlay__tags {
  flex: 0 1 46%;
  margin: 0;
  padding: 0 0 0 8px;
  font-size: 12px;
  line-height: 1.35;
  color: rgba(200, 210, 220, 0.85);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
}

html.pv-rebuild-watch-open #pv-rebuild-video-grid {
  filter: grayscale(1);
  opacity: 0.42;
  pointer-events: none;
  transition: opacity 0.2s ease, filter 0.2s ease;
}

html.pv-rebuild-watch-open #pv-shell-grid {
  overflow: hidden !important;
}

/* === BEGIN PV:REBUILD:F4_VIDEO_DOMINANCE === */
html.pv-rebuild-watch-open #pv-root > * {
  pointer-events: none;
}

html.pv-rebuild-watch-open #pv-rebuild-watch-overlay,
html.pv-rebuild-watch-open #pv-rebuild-watch-overlay * {
  pointer-events: auto;
}

html.pv-rebuild-watch-open #pv-shell-logo,
html.pv-rebuild-watch-open #pv-topbar-game,
html.pv-rebuild-watch-open #pv-topbar-nav,
html.pv-rebuild-watch-open #pv-topbar-ads,
html.pv-rebuild-watch-open #pv-shell-grid,
html.pv-rebuild-watch-open #pv-shell-pagination {
  filter: brightness(0.3);
  transition: filter 0.2s ease;
}

html.pv-rebuild-watch-open #pv-rebuild-video-grid {
  filter: none !important;
  opacity: 1 !important;
  pointer-events: none !important;
}

.pv-rebuild-watch-overlay:not([hidden]) {
  pointer-events: auto !important;
}

.pv-rebuild-watch-overlay__backdrop {
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.44);
  cursor: pointer;
}

.pv-rebuild-watch-overlay__panel,
.pv-rebuild-watch-overlay__close,
.pv-rebuild-watch-overlay__stage,
.pv-rebuild-watch-overlay__video,
.pv-rebuild-watch-overlay__fallback,
.pv-rebuild-watch-overlay__title-row {
  pointer-events: auto;
}
/* === END PV:REBUILD:F4_VIDEO_DOMINANCE === */

/* --- F-GAME-01: game console overlay (same geometry contract as F-WATCH; logo + game bar stay undimmed) --- */
.pv-game-overlay[hidden] {
  display: none !important;
}

.pv-game-overlay {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45000;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.pv-game-overlay:not([hidden]) {
  pointer-events: auto;
}

.pv-game-overlay__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.pv-game-overlay__panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  width: 80%;
  height: 80%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.72);
  box-sizing: border-box;
  overflow: hidden;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", sans-serif;
}

.pv-game-overlay__scroll {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  /* No top title bar: content starts with gallery + user actions (space is in section padding from game_console.css) */
  padding: 8px 10px 10px 10px;
  box-sizing: border-box;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.pv-game-overlay__heading {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Inner console chrome matches index.php via css/game_console.css; scale matches layout_flex :root */
#pv-game-overlay .pv-game-overlay__panel {
  --pv-ui-scale: clamp(0.45, min(calc(18vw / 260px), calc(100vh / 850px)), 1);
}

/* Screen-reader-only labels (game overlay leaderboards, etc.) */
.pv-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Game overlay: Top 5 + rank window (# / account / points / arrow / last move); thin panel borders */
/* Each column ~70% of former half-row (35%×2); space-evenly = equal gaps at edges and between panels */
#pv-game-overlay .pv-game-overlay-leaderboards {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-evenly;
  align-items: flex-start;
  align-content: flex-start;
  column-gap: 0;
  row-gap: clamp(8px, 1.6vw, 20px);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: calc(10px * var(--pv-ui-scale, 1)) 0 calc(5px * var(--pv-ui-scale, 1)) 0;
  margin: 0 auto;
}

#pv-game-overlay .pv-game-overlay-lb-column {
  flex: 0 1 35%;
  max-width: 35%;
  min-width: 0;
  box-sizing: border-box;
}

#pv-game-overlay .pv-game-overlay-lb-panel {
  border: 1px solid rgba(129, 199, 132, 0.45);
  border-radius: 10px;
  padding: calc(10px * var(--pv-ui-scale, 1)) calc(10px * var(--pv-ui-scale, 1));
  box-sizing: border-box;
  background: rgba(8, 12, 10, 0.35);
}

#pv-game-overlay .pv-game-overlay-lb-grid {
  display: grid;
  grid-template-columns: minmax(1.8em, auto) minmax(0, 1fr) minmax(3.5em, auto) minmax(0.85em, auto) minmax(3.8em, auto);
  align-items: center;
  column-gap: clamp(2px, 0.55vw, 5px);
  row-gap: calc(4px * var(--pv-ui-scale, 1));
  font-size: calc(0.84em * var(--pv-ui-scale, 1));
  font-weight: 400;
  line-height: 1.25;
  color: #81c784;
  text-align: center;
}

#pv-game-overlay .pv-game-overlay-lb-head {
  margin-bottom: calc(6px * var(--pv-ui-scale, 1));
  padding-bottom: calc(6px * var(--pv-ui-scale, 1));
  border-bottom: 1px solid rgba(129, 199, 132, 0.28);
}

#pv-game-overlay .pv-game-overlay-lb-head-arrow {
  display: block;
}

#pv-game-overlay .pv-game-overlay-lb-body {
  display: flex;
  flex-direction: column;
  gap: calc(4px * var(--pv-ui-scale, 1));
}

#pv-game-overlay .pv-game-overlay-lb-row.pv-game-overlay-lb-grid {
  display: grid;
  grid-template-columns: minmax(1.8em, auto) minmax(0, 1fr) minmax(3.5em, auto) minmax(0.85em, auto) minmax(3.8em, auto);
  align-items: center;
  column-gap: clamp(2px, 0.55vw, 5px);
  margin: 0;
  font-size: calc(0.84em * var(--pv-ui-scale, 1));
  font-weight: 400;
  line-height: 1.25;
  color: #81c784;
  text-align: center;
}

#pv-game-overlay .pv-game-overlay-lb-row--you.pv-game-overlay-lb-grid {
  font-weight: 700;
}

#pv-game-overlay .pv-game-overlay-lb-row--you .pv-game-overlay-lb-account,
#pv-game-overlay .pv-game-overlay-lb-row--you .pv-game-overlay-lb-rank,
#pv-game-overlay .pv-game-overlay-lb-row--you .pv-game-overlay-lb-points,
#pv-game-overlay .pv-game-overlay-lb-row--you .pv-game-overlay-lb-move {
  color: #ffffff;
}

#pv-game-overlay .pv-game-overlay-lb-row--you .pv-game-overlay-lb-arrow--up,
#pv-game-overlay .pv-game-overlay-lb-row--you .pv-game-overlay-lb-arrow--down,
#pv-game-overlay .pv-game-overlay-lb-row--you .pv-game-overlay-lb-arrow--flat {
  color: #ffffff;
}

#pv-game-overlay .pv-game-overlay-lb-rank,
#pv-game-overlay .pv-game-overlay-lb-account,
#pv-game-overlay .pv-game-overlay-lb-points,
#pv-game-overlay .pv-game-overlay-lb-move {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#pv-game-overlay .pv-game-overlay-lb-arrow {
  font-size: 1em;
  line-height: 1;
}

#pv-game-overlay .pv-game-overlay-lb-arrow--up {
  color: #2e7d32;
}

#pv-game-overlay .pv-game-overlay-lb-arrow--down {
  color: #c62828;
}

#pv-game-overlay .pv-game-overlay-lb-arrow--flat {
  color: inherit;
}

#pv-game-overlay .pv-extended-console-gallery-header {
  padding-top: calc(6px * var(--pv-ui-scale, 1));
}

@media (max-width: 640px) {
  #pv-game-overlay .pv-game-overlay-leaderboards {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    row-gap: calc(10px * var(--pv-ui-scale, 1));
  }

  #pv-game-overlay .pv-game-overlay-lb-column {
    flex: 0 1 auto;
    width: 70%;
    max-width: 70%;
  }
}

/* Same quantized columns as .pv-rebuild-video-grid (JS sets --pv-rebuild-grid-cols on this subtree) */
#pv-game-overlay .pv-extended-console-gallery-grid {
  grid-template-columns: repeat(var(--pv-rebuild-grid-cols, 4), minmax(0, 1fr));
  gap: clamp(8px, 1.2vw, 14px) clamp(8px, 1.5vw, 16px);
}

html.pv-rebuild-game-open #pv-rebuild-video-grid {
  filter: grayscale(1);
  opacity: 0.42;
  pointer-events: none;
  transition: opacity 0.2s ease, filter 0.2s ease;
}

html.pv-rebuild-game-open #pv-shell-grid {
  overflow: hidden !important;
}

/* === BEGIN PV:REBUILD:F4_GAME_DOMINANCE === */
html.pv-rebuild-game-open #pv-root > * {
  pointer-events: none;
}

html.pv-rebuild-game-open #pv-game-overlay,
html.pv-rebuild-game-open #pv-game-overlay * {
  pointer-events: auto;
}

html.pv-rebuild-game-open #pv-shell-logo,
html.pv-rebuild-game-open #pv-topbar-game {
  pointer-events: auto;
  filter: none;
}

html.pv-rebuild-game-open #pv-topbar-nav,
html.pv-rebuild-game-open #pv-topbar-ads,
html.pv-rebuild-game-open #pv-topbar-feed,
html.pv-rebuild-game-open #pv-shell-grid,
html.pv-rebuild-game-open #pv-shell-pagination {
  filter: brightness(0.3);
  transition: filter 0.2s ease;
}

html.pv-rebuild-game-open #pv-rebuild-video-grid {
  filter: none !important;
  opacity: 1 !important;
  pointer-events: none !important;
}

.pv-game-overlay:not([hidden]) {
  pointer-events: auto !important;
}

.pv-game-overlay__backdrop {
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.44);
  cursor: pointer;
}

.pv-game-overlay__panel,
.pv-game-overlay__scroll {
  pointer-events: auto;
}
/* === END PV:REBUILD:F4_GAME_DOMINANCE === */

