/**
 * WorldKernel.champion — portrait + XP (+ puzzle controls) dock.
 * body.world-champion-chrome is set by ChampionChrome.js for every game type.
 *
 * Float mode moves the board to a centered layer (z≈40). Portrait was left in
 * document flow under the board. Pin it as a fixed LEFT dock in the wizard wing.
 */

body.chess-page.world-champion-chrome .chess-hero-portrait,
body.chess-page.world-champion-chrome #chess-hero-portrait {
  /* Fixed left wing — same side as shadow wizard, never under the board */
  position: fixed !important;
  left: max(10px, 1.2vw) !important;
  top: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translateY(-42%) !important;

  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 0 !important;

  width: 148px !important;
  min-width: 136px !important;
  max-width: 160px !important;
  height: auto !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0.4rem 0.45rem 0.5rem !important;
  box-sizing: border-box !important;

  opacity: 1 !important;
  visibility: visible !important;
  /* No scrollbars — dock grows with avatar + XP + HUD + feed */
  overflow: visible !important;
  pointer-events: auto !important;
  border: none !important;
  flex: none !important;
  align-self: auto !important;

  /* Above wizard (z=3) and float boards (z=40) so never "behind" the board */
  z-index: 48 !important;

  /* Soft plate so it reads over the wizard art */
  background: linear-gradient(
    165deg,
    rgba(4, 18, 12, 0.72) 0%,
    rgba(2, 10, 6, 0.55) 100%
  ) !important;
  border-radius: 12px !important;
  box-shadow:
    0 0 0 1px rgba(0, 255, 136, 0.18),
    0 10px 28px rgba(0, 0, 0, 0.45) !important;
  backdrop-filter: blur(3px);
}

/* HP rail under XP — same numeric shape (cur / max) */
body.chess-page.world-champion-chrome .live-hp-rail.is-portrait,
body.chess-page.world-champion-chrome #live-hp-rail {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 0.25rem 0.3rem !important;
  width: 100% !important;
  max-width: 100% !important;
  margin-top: 0.2rem !important;
  padding: 0.2rem 0.05rem 0.05rem !important;
  box-sizing: border-box !important;
  border-top: 1px solid rgba(255, 100, 100, 0.18);
  font-family: "Courier New", Courier, monospace;
}
body.chess-page.world-champion-chrome .live-hp-tag {
  flex: 0 0 auto;
  min-width: 1.25rem;
  height: 1.1rem;
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  display: grid;
  place-items: center;
  border-radius: 3px;
  border: 1px solid rgba(255, 120, 120, 0.45);
  background: linear-gradient(180deg, #3a1010, #140606);
  color: #ff9a9a;
}
body.chess-page.world-champion-chrome .live-hp-track {
  position: relative;
  flex: 1 1 4.5rem !important;
  min-width: 3.2rem !important;
  height: 0.92rem !important;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 100, 100, 0.3);
  overflow: hidden;
}
body.chess-page.world-champion-chrome .live-hp-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6b1a1a 0%, #cc3333 50%, #ff6a6a 100%);
  transition: width 0.35s ease;
  z-index: 1;
}
body.chess-page.world-champion-chrome .live-hp-fill.is-low {
  background: linear-gradient(90deg, #7a4a10, #e0a020);
}
body.chess-page.world-champion-chrome .live-hp-fill.is-crit {
  background: linear-gradient(90deg, #4a0000, #ff2020);
}
body.chess-page.world-champion-chrome .live-hp-meta {
  display: none !important;
}
body.chess-page.world-champion-chrome .live-hp-track .live-hp-label,
body.chess-page.world-champion-chrome .live-hp-label {
  position: absolute !important;
  inset: 0 !important;
  z-index: 3 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 0.52rem !important;
  font-weight: 800 !important;
  color: #fff0f0 !important;
  text-shadow:
    0 0 2px #000,
    0 1px 2px rgba(0, 0, 0, 0.95) !important;
  white-space: nowrap !important;
  pointer-events: none !important;
}

/* XP rail under avatar — compact so level chip + bar fit the dock */
body.chess-page.world-champion-chrome .live-xp-rail.is-portrait,
body.chess-page.world-champion-chrome #live-xp-rail {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 0.25rem 0.3rem !important;
  opacity: 1 !important;
  visibility: visible !important;
  max-width: 100% !important;
  width: 100% !important;
  margin-top: 0.28rem !important;
  padding: 0.3rem 0.05rem 0.1rem !important;
  box-sizing: border-box !important;
  overflow: visible !important;
}

body.chess-page.world-champion-chrome .live-xp-level {
  min-width: 1.25rem !important;
  height: 1.15rem !important;
  font-size: 0.62rem !important;
  padding: 0 0.15rem !important;
}

body.chess-page.world-champion-chrome .live-xp-track {
  flex: 1 1 4.5rem !important;
  min-width: 3.2rem !important;
  height: 0.92rem !important;
  position: relative !important;
  overflow: hidden !important;
}

body.chess-page.world-champion-chrome .live-xp-meta {
  display: none !important;
}

body.chess-page.world-champion-chrome .live-xp-track .live-xp-label,
body.chess-page.world-champion-chrome .live-xp-label {
  position: absolute !important;
  inset: 0 !important;
  z-index: 3 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 0.52rem !important;
  font-weight: 800 !important;
  color: #f2fff6 !important;
  text-shadow:
    0 0 2px #000,
    0 1px 2px rgba(0, 0, 0, 0.95) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  pointer-events: none !important;
  min-width: 0 !important;
}

body.chess-page.world-champion-chrome .live-xp-rest {
  /* secondary hint lives in aria / title only */
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
}

/* Combat feed: cap height without a visible scrollbar */
body.chess-page.world-champion-chrome #combat-feed,
body.chess-page.world-champion-chrome .combat-feed {
  max-height: 4.2rem !important;
  overflow: hidden !important;
  scrollbar-width: none !important;
}
body.chess-page.world-champion-chrome .combat-feed::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Puzzle HUD inside dock — never force parent scroll */
body.chess-page.world-champion-chrome #chess-hero-portrait .chess-puzzle-ladder-hud,
body.chess-page.world-champion-chrome #chess-hero-portrait #chess-puzzle-ladder-hud {
  overflow: hidden !important;
  max-height: none !important;
}

/* Frame + meta breathe a little wider */
body.chess-page.world-champion-chrome .hero-frame-wow {
  width: 120px !important;
  height: 132px !important;
}

body.chess-page.world-champion-chrome .hero-portrait-meta {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow: visible !important;
}

/* Density ladder must not collapse champion chrome */
body.chess-page.world-champion-chrome[data-arena-density='compact'] .chess-hero-portrait,
body.chess-page.world-champion-chrome[data-arena-density='tight'] .chess-hero-portrait,
body.chess-page.world-champion-chrome[data-arena-density='micro'] .chess-hero-portrait,
body.chess-page.world-champion-chrome[data-arena-density='cozy'] .chess-hero-portrait {
  opacity: 1 !important;
  max-width: 160px !important;
  width: 148px !important;
  min-width: 136px !important;
  margin: 0 !important;
  padding: 0.4rem 0.45rem 0.5rem !important;
  overflow: visible !important;
  pointer-events: auto !important;
  flex: none !important;
  position: fixed !important;
  left: max(10px, 1.2vw) !important;
  top: 50% !important;
  transform: translateY(-42%) !important;
  z-index: 48 !important;
}

body.chess-page.world-champion-chrome[data-arena-density='cozy'] .chess-hero-portrait .hero-portrait-xp,
body.chess-page.world-champion-chrome[data-arena-density='cozy'] .chess-hero-portrait .xp-meter-label {
  display: block !important;
}

/* Float mode: keep left dock (do not re-center or hide) */
body.chess-page.world-champion-chrome.arena-float-active .chess-hero-portrait,
body.chess-page.world-champion-chrome.arena-float-active #chess-hero-portrait {
  position: fixed !important;
  left: max(10px, 1.2vw) !important;
  top: 50% !important;
  transform: translateY(-42%) !important;
  z-index: 48 !important;
  display: flex !important;
  flex-direction: column !important;
  width: 148px !important;
  max-width: 160px !important;
}

/* Puzzle / opening ladder HUD lives inside the left dock */
body.chess-page.world-champion-chrome #chess-hero-portrait .chess-puzzle-ladder-hud,
body.chess-page.world-champion-chrome #chess-hero-portrait #chess-puzzle-ladder-hud {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin-top: 0.4rem !important;
  z-index: 1 !important;
}

/* Narrow desktop: still left, slightly smaller */
@media (max-width: 1000px) {
  body.chess-page.world-champion-chrome .chess-hero-portrait {
    display: flex !important;
    width: 136px !important;
    min-width: 128px !important;
    left: 8px !important;
  }
}

/* Phone / very narrow: bottom-left strip so board keeps center */
@media (max-width: 700px) {
  body.chess-page.world-champion-chrome .chess-hero-portrait,
  body.chess-page.world-champion-chrome.arena-float-active .chess-hero-portrait {
    top: auto !important;
    bottom: 4.5rem !important;
    left: 8px !important;
    transform: none !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    width: auto !important;
    max-width: min(96vw, 320px) !important;
    align-items: flex-start !important;
  }
}
