/* ================================================================
   NO PERRY — Responsive Visual Integrity Recovery (35A)
   Owners: portfolio fail-open, avatar apertures, podium frame safe area,
   header/stats overflow. Does not touch scoring / GameInfo / D1.
   ================================================================ */

:root {
  --np-avatar-portrait-scale: 2.08;
  --np-avatar-face-y: 28%;
}

/* —— BUG A: Carlos portfolio exists in normal flow on mobile —— */
@media (max-width: 900px) {
  #world-reveal {
    height: auto !important;
    min-height: 0;
    overflow: visible;
  }

  #world-reveal .np-world-bridge-inner {
    position: relative;
    top: auto;
    height: auto;
    min-height: 0;
    overflow: visible;
    display: flex;
    flex-direction: column;
  }

  #world-reveal .np-scene.np-scene--vista {
    position: relative;
    inset: auto;
    width: 100%;
    height: 68vh;
    min-height: 280px;
    flex: 0 0 auto;
    opacity: 1;
    z-index: 3;
  }

  #world-reveal #world-canvas,
  #world-reveal .np-ridge,
  #world-reveal .np-fog,
  #world-reveal .np-fore,
  #world-reveal .np-light,
  #world-reveal .np-vignette,
  #world-reveal .np-stage-copy,
  #world-reveal .np-creator-light,
  #world-reveal .np-creator-vignette {
    top: 0;
    bottom: auto;
    height: 68vh;
    max-height: 68vh;
    pointer-events: none;
  }

  #world-reveal .np-world-bridge-exit {
    position: relative;
    height: 8vh;
    opacity: 1;
  }

  #np-creator-beat,
  #world-reveal .np-creator-beat {
    position: relative !important;
    inset: auto !important;
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0;
    padding: 2.75rem 1.15rem 3.5rem;
    overflow: visible;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    pointer-events: auto !important;
    content-visibility: visible;
    contain: none;
    background:
      linear-gradient(180deg, rgba(8, 8, 16, 0.2) 0%, var(--void, #080810) 18%);
  }

  #world-reveal .np-creator-layout,
  #world-reveal .np-creator-portrait-wrap,
  #world-reveal .np-creator-portrait,
  #world-reveal .np-creator-copy,
  #world-reveal .np-creator-eyebrow,
  #world-reveal .np-creator-name,
  #world-reveal .np-creator-desc,
  #world-reveal .np-creator-tags,
  #world-reveal .np-creator-cta,
  #world-reveal .np-creator-micro {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    pointer-events: auto;
  }

  #world-reveal .np-creator-portrait {
    width: min(48vw, 168px);
    padding: 0;
    overflow: hidden;
  }

  #world-reveal .np-creator-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 16%;
  }
}

/* Fail-open even if reveal JS never runs (any viewport) */
html.np-reduced #np-creator-beat,
html.np-reveal-failopen #np-creator-beat.is-failopen {
  opacity: 1;
  pointer-events: auto;
}

/* —— BUG B: portrait fills aperture; frame/ring stay above —— */
.np-avatar-aperture {
  position: absolute;
  z-index: 1;
  inset: 4%;
  width: auto;
  height: auto;
  overflow: hidden;
  border-radius: 50%;
  pointer-events: none;
}

.np-avatar-aperture .member-avatar,
.np-avatar-aperture .np-avatar-portrait,
.np-avatar-aperture .np-relic__avatar {
  position: absolute !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  object-fit: cover !important;
  object-position: center var(--np-avatar-face-y) !important;
  border-radius: 50%;
  transform: scale(var(--np-avatar-portrait-scale)) !important;
  transform-origin: center var(--np-avatar-face-y);
  aspect-ratio: auto;
  z-index: 1;
  opacity: 1;
}

.np-war-portrait .member-ring,
.np-war-row-portrait .member-ring,
.np-relic__medallion .member-ring,
.np-relic__medallion .np-relic__ring {
  z-index: 3;
  pointer-events: none;
}

.np-war-portrait .np-rank-approved-emblem {
  z-index: 2;
}

#hall-of-fame.np-hall-relics-27a .np-relic__medallion {
  overflow: hidden;
}

#hall-of-fame.np-hall-relics-27a .np-relic__medallion .np-avatar-aperture {
  inset: 1px;
}

#hall-of-fame.np-hall-relics-27a .np-relic__avatar.member-avatar {
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.np-podium-25b .np-podium-medallion .np-war-portrait {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0 !important;
  overflow: visible;
}

.np-podium-25b .np-podium-medallion .np-avatar-aperture {
  inset: 5%;
}

.np-war-row-portrait {
  overflow: visible;
}

.np-war-row-portrait .np-avatar-aperture {
  inset: 6%;
}

.np-war-row-portrait .member-avatar {
  transform: scale(var(--np-avatar-portrait-scale)) !important;
}

/* —— BUG D: podium FRAME SAFE AREA from segmented geometry ——
   gold  topEnd 199/905 = 22.0%  bottomStart 678/905 → bottom 25.1%
   silver topEnd 187/850 = 22.0%  bottomStart 629/850 → bottom 26.0%
   bronze topEnd 183/835 = 21.9%  bottomStart 617/835 → bottom 26.1%
*/
#war-ladder .np-podium-25b,
.np-war-ladder .np-podium-25b {
  --podium-frame-top-end: 22%;
  --podium-frame-bottom-start: 74.9%;
  --podium-safe-top: 48.5%;
  --podium-safe-right: 14%;
  --podium-safe-bottom: 13.5%;
  --podium-safe-left: 14%;
  --inner-top: 43%;
  --inner-bottom: var(--podium-safe-bottom);
  --inner-x: var(--podium-safe-left);
  --content-safe-top: var(--podium-safe-top);
  --content-safe-bottom: var(--podium-safe-bottom);
  --safe-top: var(--podium-safe-top);
  --safe-bottom: var(--podium-safe-bottom);
  --safe-x: var(--podium-safe-left);
}

#war-ladder .np-podium-25b.np-war-card--champion,
.np-war-ladder .np-podium-25b.np-war-card--champion {
  --podium-frame-top-end: 22%;
  --podium-frame-bottom-start: 74.9%;
  --podium-safe-top: 49%;
  --podium-safe-right: 13.5%;
  --podium-safe-bottom: 13%;
  --podium-safe-left: 13.5%;
  --inner-top: 44%;
}

#war-ladder .np-podium-25b.np-war-card--silver,
.np-war-ladder .np-podium-25b.np-war-card--silver {
  --podium-frame-top-end: 22%;
  --podium-frame-bottom-start: 74%;
  --podium-safe-top: 49.5%;
  --podium-safe-right: 12.5%;
  --podium-safe-bottom: 14%;
  --podium-safe-left: 12.5%;
  --inner-top: 44.5%;
}

#war-ladder .np-podium-25b.np-war-card--bronze,
.np-war-ladder .np-podium-25b.np-war-card--bronze {
  --podium-frame-top-end: 21.9%;
  --podium-frame-bottom-start: 73.9%;
  --podium-safe-top: 49.5%;
  --podium-safe-right: 13%;
  --podium-safe-bottom: 14%;
  --podium-safe-left: 13%;
  --inner-top: 44.5%;
}

#war-ladder .np-podium-25b > .np-podium-inner-surface,
.np-war-ladder .np-podium-25b > .np-podium-inner-surface {
  top: var(--inner-top);
  right: var(--podium-safe-right);
  bottom: var(--podium-safe-bottom);
  left: var(--podium-safe-left);
  z-index: 1;
  overflow: hidden;
  background: radial-gradient(
    ellipse 78% 62% at 50% 42%,
    rgba(6, 5, 10, 0.42) 0%,
    rgba(6, 5, 10, 0.18) 52%,
    rgba(6, 5, 10, 0.04) 78%,
    rgba(6, 5, 10, 0) 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.35) 10%,
    #000 28%,
    #000 86%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.35) 10%,
    #000 28%,
    #000 86%,
    transparent 100%
  );
  clip-path: inset(0 0 0 0);
}

#war-ladder .np-podium-25b > .np-podium-content,
.np-war-ladder .np-podium-25b > .np-podium-content {
  top: var(--podium-safe-top);
  right: var(--podium-safe-right);
  bottom: var(--podium-safe-bottom);
  left: var(--podium-safe-left);
  inset-block-start: var(--podium-safe-top);
  inset-block-end: var(--podium-safe-bottom);
  inset-inline-start: var(--podium-safe-left);
  inset-inline-end: var(--podium-safe-right);
  z-index: 2;
  overflow: hidden;
  background: transparent;
}

#war-ladder .np-podium-25b > .np-frame-top,
.np-war-ladder .np-podium-25b > .np-frame-top {
  z-index: 8;
}

#war-ladder .np-podium-25b > .np-frame-left,
.np-war-ladder .np-podium-25b > .np-frame-left,
#war-ladder .np-podium-25b > .np-frame-right,
.np-war-ladder .np-podium-25b > .np-frame-right {
  z-index: 7;
}

#war-ladder .np-podium-25b > .np-frame-bottom,
.np-war-ladder .np-podium-25b > .np-frame-bottom {
  z-index: 9;
}

#war-ladder .np-podium-25b > .np-podium-medallion,
.np-war-ladder .np-podium-25b > .np-podium-medallion {
  z-index: 6;
}

#war-ladder .np-podium-25b > .np-podium-rank-label,
.np-war-ladder .np-podium-25b > .np-podium-rank-label,
#war-ladder .np-podium-25b .np-war-champion-eyebrow,
.np-war-ladder .np-podium-25b .np-war-champion-eyebrow {
  z-index: 10;
}

@media (max-width: 430px) {
  #war-ladder .np-podium-25b,
  .np-war-ladder .np-podium-25b {
    --podium-safe-top: 51%;
    --podium-safe-right: 15.5%;
    --podium-safe-left: 15.5%;
    --podium-safe-bottom: 14.5%;
    --inner-top: 47%;
  }

  #war-ladder .np-podium-25b.np-war-card--champion,
  .np-war-ladder .np-podium-25b.np-war-card--champion {
    --podium-safe-top: 51.5%;
    --podium-safe-right: 15%;
    --podium-safe-left: 15%;
    --inner-top: 47.5%;
  }
}

@media (max-width: 390px) {
  #war-ladder .np-podium-25b,
  .np-war-ladder .np-podium-25b {
    --podium-safe-top: 52%;
    --podium-safe-right: 16%;
    --podium-safe-left: 16%;
    --inner-top: 48%;
  }
}

@media (max-width: 360px) {
  #war-ladder .np-podium-25b,
  .np-war-ladder .np-podium-25b {
    --podium-safe-top: 52.5%;
    --podium-safe-right: 16.5%;
    --podium-safe-left: 16.5%;
    --inner-top: 48.5%;
  }
}

/* —— Header / stats: minimal overflow repair —— */
html, body {
  overflow-x: clip;
}

@media (max-width: 700px) {
  #navbar .nav-cta,
  #navbar .nav-cta.np-pixel-btn,
  #navbar .np-pixel-btn--nav {
    display: none !important;
  }
}

@media (max-width: 430px) {
  #navbar {
    padding: 0 0.55rem;
  }

  .nav-inner {
    height: 64px;
    gap: 0.35rem;
    min-width: 0;
  }

  .nav-logo-text {
    font-size: 0.92rem;
    letter-spacing: 0.06em;
  }

  .nav-logo-tag {
    font-size: 0.55rem;
  }

  .lang-switch {
    margin-left: auto;
    gap: 0;
    flex-shrink: 0;
  }

  .lang-switch button {
    padding: 0.32rem 0.28rem;
    font-size: 0.56rem;
    letter-spacing: 0.08em;
  }

  .nav-burger {
    margin-left: 0.15rem;
  }

  #stats-bar {
    padding: 0.4rem 0.55rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .stats-inner {
    gap: 0.55rem 0.85rem;
    justify-content: space-around;
    flex-wrap: wrap;
  }

  .stat-num {
    font-size: 0.78rem;
  }

  .stat-label {
    font-size: 0.52rem;
    letter-spacing: 0.1em;
  }
}
