/* Avatar + lifetime rank chip (public/rank-chip.js, flag rankChipEnabled). The chip
   is a JS-appended child of .score-bar, so none of this applies until the flag is
   on. The element is a 44 px tap box; the visible pill (.rank-chip-face) sits inside
   it, and the negative margin hands the padding back so the pill lands where the
   offsets say. This file loads BEFORE scene-fit.css, so every scene rule below uses
   the same #game-screen ancestry that file does. */

/* Plain layout: top left of the score bar, under the lives pill. */
.score-bar.has-rank-chip {
  position: relative;
}
.rank-chip {
  position: absolute;
  z-index: 6;
  top: 3px;
  left: 14px;
  box-sizing: border-box;
  min-width: 44px;
  min-height: 44px;
  margin: -6px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.rank-chip.is-inert {
  pointer-events: none;
  cursor: default;
}
.rank-chip:focus-visible {
  outline: 3px solid #fbbf24;
  outline-offset: -3px;
  border-radius: 22px;
}
/* A narrow stack, not a row: the 28 px avatar with the rank pill tucked over its bottom edge. A row ("#412" beside the
   avatar) is 81 px wide and bites the dinosaur's face band in every scene (measured 2026-10-29, 16 to 21% of the band's
   width at 320 to 390), and at 320 it runs into an 8-digit score in the plain layout. The stack is as wide as the avatar. */
.rank-chip-face {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  color: #fff;
}
.rank-chip-avatar {
  display: flex;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--scene-plate-hud-item, rgba(10, 10, 26, 0.6));
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.55);
  align-items: center;
  justify-content: center;
}
.rank-chip-avatar .rank-chip-portrait {
  display: block;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  object-fit: cover;
}
.rank-chip-avatar .rank-chip-portrait svg {
  width: 100%;
  height: 100%;
}
.rank-chip-avatar .rank-chip-glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}
.rank-chip-rank {
  position: relative;
  margin-top: -7px;
  padding: 2px 3px;
  border-radius: 8px;
  background: rgba(10, 10, 26, 0.85);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 12px;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rank-chip-rank:empty {
  display: none;
}
/* Last known value after a failed refresh: dimmed, never shown as if it were current. */
.rank-chip.is-stale .rank-chip-rank {
  opacity: 1;
  color: rgba(255, 255, 255, 0.72);
  box-shadow: none;
  outline: 1px dashed rgba(255, 255, 255, 0.55);
  outline-offset: -1px;
}

/* Scene column: the score chip's top, at the strip's left edge (the score chip is its mirror on the right). */
#game-screen.dinosaur-scene-active.scene-fit .score-bar .rank-chip {
  top: calc(var(--sf-art-top) - var(--sf-strip-top) + 16px);
  left: 0;
}

/* Hidden like the trophy: the 2 x 2 rails have no free corner, and the landscape layout (game.html, max-height 500px) has no room. */
#game-screen.scene-fit-rails .rank-chip {
  display: none;
}
@media (orientation: landscape) and (max-height: 500px) {
  .rank-chip {
    display: none;
  }
}
