/* Full-color collectible art. Gameplay geometry stays owned by the grid. */
.dino-art,
.lb-dino,
.dinosaur-hud-portrait,
.pass-capstone-portrait {
  object-fit: contain;
}
.dino-art svg {
  width: 100%;
  height: 100%;
}
#game-screen {
  position: relative;
  isolation: isolate;
}
#dinosaur-scene-layer {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: var(--scene-position, center top);
}
#game-screen.dinosaur-scene-active .board-dino-scene {
  display: none;
}
/* Plate tokens: each plate the scene fit changes (public/scene-fit.css) is a custom
   property here, declared with today's value, so a scene without a fit renders as ever. */
#game-screen.dinosaur-scene-active {
  --scene-plate-grid-top: rgba(10, 10, 26, 0.8);
  --scene-plate-grid-bottom: rgba(10, 10, 26, 0.86);
  --scene-plate-badge: rgba(10, 10, 26, 0.8);
  --scene-plate-topbar-top: rgba(10, 10, 26, 0.84);
  --scene-plate-topbar-bottom: rgba(10, 10, 26, 0.72);
  --scene-plate-hud-item: rgba(10, 10, 26, 0.8);
  --scene-plate-chip: rgba(10, 10, 26, 0.88);
  --scene-plate-powerups: rgba(10, 10, 26, 0.9);
}
#game-screen.dinosaur-scene-active .grid {
  background: linear-gradient(var(--scene-plate-grid-top), var(--scene-plate-grid-bottom));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.26),
    0 8px 32px rgba(0, 0, 0, 0.5);
}
#game-screen.dinosaur-scene-active .top-bar,
#game-screen.dinosaur-scene-active .level-info,
#game-screen.dinosaur-scene-active .level-target {
  position: relative;
}
#game-screen.dinosaur-scene-active .level-badge {
  background: var(--scene-plate-badge);
}
.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.dinosaur-hud-portrait {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
#leaderboard-screen .lb-dino {
  width: 26px;
  height: 26px;
  vertical-align: middle;
}
#den-screen > div {
  max-width: 640px !important;
}
#den-list {
  margin-top: 14px;
}
.den-card.dinosaur-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  padding: 14px;
  background:
    radial-gradient(ellipse at 20% 15%, rgba(240, 147, 251, 0.15), transparent 65%), rgba(255, 255, 255, 0.04);
}
.dinosaur-card .den-emoji {
  width: 112px;
  grid-row: 1/3;
}
.dinosaur-card .den-emoji .dino-art {
  width: 112px;
  height: 112px;
}
.dinosaur-card .den-name {
  font-size: 1rem;
  line-height: 1.2;
}
.dinosaur-card .den-cond {
  font-size: 0.8rem;
  line-height: 1.4;
  margin-top: 5px;
}
.dinosaur-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.dinosaur-card-actions .btn {
  min-height: 40px;
}
.dinosaur-card .den-info {
  padding-top: 8px;
}
.dinosaur-card.season-exclusive::after {
  font-size: 0.56rem;
}
.den-roster-card .den-emoji {
  width: 76px;
  flex-shrink: 0;
}
.den-roster-card .den-emoji .dino-art {
  width: 76px;
  height: 76px;
}
.den-roster-card {
  opacity: 1;
}
.expedition-portrait {
  width: 64px;
  height: 64px;
  object-fit: contain;
  flex-shrink: 0;
}
.dinosaur-preview {
  max-width: 440px;
  max-height: 90vh;
  overflow: auto;
}
.dinosaur-preview h2 {
  padding: 0 20px;
}
.dinosaur-board-preview {
  position: relative;
  width: min(100%, 240px);
  aspect-ratio: 2/3;
  margin: 12px auto;
  border-radius: 16px;
  overflow: hidden;
  background: #0a0a1a;
}
.dinosaur-board-preview > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.dinosaur-preview-tiles {
  position: absolute;
  inset: 45% 12% 8%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 6px;
  background: rgba(10, 10, 26, 0.68);
  border-radius: 8px;
}
.dinosaur-preview-tiles span {
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: #5b3590;
  color: white;
  font-weight: 700;
  font-size: 16px;
}
.dinosaur-portrait-preview {
  height: 260px;
  margin: auto;
}
.dinosaur-preview-portrait {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.dinosaur-pass-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  margin: 8px auto;
  max-width: 320px;
  border-radius: 18px;
  background: radial-gradient(ellipse, rgba(240, 147, 251, 0.2), transparent 70%);
}
.dinosaur-pass-portrait {
  width: 152px;
  height: 152px;
  object-fit: contain;
}
#dinosaur-pass-hero[role='button'] {
  cursor: pointer;
}
#dinosaur-pass-hero:focus-visible {
  outline: 3px solid #fbbf24;
  outline-offset: 3px;
}
.pass-capstone-portrait {
  display: block;
  width: 68px;
  height: 68px;
  margin: auto;
}
.dinosaur-reveal-portrait {
  width: 180px;
  height: 180px;
  object-fit: contain;
}
.dinosaur-unlock-portrait {
  width: 42px;
  height: 42px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 7px;
}
.season-splash .dinosaur-season-portrait {
  width: clamp(100px, 32vw, 180px);
  height: clamp(100px, 32vw, 180px);
  object-fit: contain;
  margin: 0 auto 10px;
}
@media (max-width: 359px) {
  .den-card.dinosaur-card {
    grid-template-columns: 86px minmax(0, 1fr);
    padding: 10px;
    gap: 8px;
  }
  .dinosaur-card .den-emoji,
  .dinosaur-card .den-emoji .dino-art {
    width: 86px;
    height: 100px;
  }
  .dinosaur-card-actions .btn {
    font-size: 0.7rem;
    padding: 8px;
  }
  .dinosaur-hud-portrait {
    width: 24px;
    height: 24px;
  }
  .dinosaur-pass-portrait {
    width: 116px;
    height: 116px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .dinosaur-pass-portrait,
  .dinosaur-reveal-portrait {
    animation: none !important;
  }
}

.dinosaur-shop-portrait {
  width: 96px;
  height: 96px;
  object-fit: contain;
  display: block;
  margin: 0 auto 8px;
}

/* Hidden CTAs must stay hidden even though the shared .btn sets display. */
#dinosaur-preview-modal [hidden] {
  display: none !important;
}

/* Keep the default HUD unchanged when no collectible scene is selected. */
.score-caption {
  display: none;
}
.quest-line {
  color: #4ade80;
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 2px;
}
.next-block-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Shared HUD surfaces protect every scene's text without dimming the art. */
#game-screen.dinosaur-scene-active .top-bar {
  background: linear-gradient(180deg, var(--scene-plate-topbar-top), var(--scene-plate-topbar-bottom));
}
#game-screen.dinosaur-scene-active .top-bar .hud-item {
  background: var(--scene-plate-hud-item);
  border-color: rgba(255, 255, 255, 0.3);
}
#game-screen.dinosaur-scene-active .top-bar .gold-display {
  color: #ffe08a;
}
#game-screen.dinosaur-scene-active .score-chip {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  padding: 2px 12px;
  border-radius: 12px;
  background: var(--scene-plate-chip);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}
#game-screen.dinosaur-scene-active .score-caption {
  display: inline;
  color: #e6e5f5;
  font-size: 0.75rem;
  font-weight: 800;
}
#game-screen.dinosaur-scene-active .score-value {
  background: none;
  color: #fff;
  -webkit-text-fill-color: #fff;
  text-shadow: 0 1px 3px #000;
}
#game-screen.dinosaur-scene-active .quest-line {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--scene-plate-chip);
  color: #bdf5ce;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
}
/* Status pills get the HUD ink under their own tint: on a bright painting the Tide
   current's light text otherwise disappears into the sky. */
#game-screen.dinosaur-scene-active .status-pill-row > .status-pill,
#game-screen.dinosaur-scene-active #event-pill {
  background-color: var(--scene-plate-hud-item);
}

/* The target bar represents block progress, separate from the point score. */
#game-screen.dinosaur-scene-active .target-row {
  background: var(--scene-plate-chip);
  border-radius: 5px;
  text-shadow: 0 1px 2px #000;
}
#game-screen.dinosaur-scene-active .target-progress-bar {
  background: rgba(10, 10, 26, 0.9);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}
#game-screen.dinosaur-scene-active .powerup-bar {
  background: var(--scene-plate-powerups);
  border-color: rgba(255, 255, 255, 0.22);
}
#game-screen.dinosaur-scene-active .powerup-btn:disabled {
  opacity: 0.72;
  filter: grayscale(0.65) brightness(0.9);
}
#game-screen.dinosaur-scene-active .powerup-btn.pu-poor {
  opacity: 0.68;
}
#game-screen.dinosaur-scene-active .powerup-btn.pu-poor:disabled {
  opacity: 0.6;
}
#game-screen.dinosaur-scene-active .next-block-label,
#game-screen.dinosaur-scene-active .drop-counter,
#game-screen.dinosaur-scene-active .speed-timer {
  color: #f4f1ff;
}
#game-screen.dinosaur-scene-active .grid-col-num {
  background: rgba(10, 10, 26, 0.72);
  border-radius: 4px;
  color: #f4f1ff;
  font-weight: 700;
  text-shadow: 0 1px 2px #000;
}
#game-screen.dinosaur-scene-active .grid-col-num.col-full {
  color: #fca5a5;
}
#level-badge .dinosaur-hud-portrait {
  width: 1.35em;
  height: 1em;
}

/* The existing landscape flex layout shares chrome horizontally. Its old
   20rem portrait budget reduced 390px-high boards to six-pixel cells. Keep
   the same layout with a measured landscape budget and a readable floor. */
@media (orientation: landscape) and (max-height: 500px) {
  :root {
    --cell-size: max(
      20px,
      min(
        clamp(28px, 8vh, 40px),
        calc((100vw - 1rem - var(--sal) - var(--sar) - (var(--grid-cols) + 1) * var(--gap)) / var(--grid-cols)),
        calc(
          (100vh - 10rem - var(--sat) - var(--sab) - var(--banner-h) - (var(--grid-rows) + 1) * var(--gap)) /
            var(--grid-rows)
        )
      )
    );
  }
  #game-screen {
    align-content: flex-start;
  }
  .status-pill-row,
  .free-chest-row {
    max-width: none;
    width: calc(50% - 4px);
    height: 28px;
    min-height: 28px;
  }
  .powerup-bar {
    max-width: 340px;
    overflow-x: auto;
    justify-content: flex-start;
  }
  .bottom-bar {
    max-width: 230px;
  }
}
