/* Keep page content from competing with the persistent mobile navigation. */
.underworld-shell .uw-tool-nav-dock,
.underworld-shell .uw-header {
  background: #0c0c10 !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

.underworld-shell .daemon-select-panel {
  background: #101014 !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

.underworld-shell .rarity-dialog-content > details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 8px 0;
  list-style: none;
  cursor: pointer;
}
.underworld-shell .rarity-dialog-content > details > summary::-webkit-details-marker {
  display: none;
}
.underworld-shell .rarity-dialog-content > details > summary::after {
  content: '';
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.underworld-shell .rarity-dialog-content > details[open] > summary::after {
  transform: rotate(180deg);
}
.underworld-shell .rarity-dialog-content > details > summary:focus-visible {
  outline: 2px solid #c3ff5c;
  outline-offset: 3px;
  border-radius: 4px;
}

.underworld-shell .uw-rarity-page .compare-tray {
  background: #101014 !important;
}
.underworld-shell .uw-rarity-page .compare-tray button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1.4;
  border-radius: 8px;
  color: #101610;
  background: #c3ff5c;
}
.underworld-shell .uw-rarity-page .compare-tray button:last-child {
  color: #edf1e7;
  background: #17171e;
  border: 1px solid #43434f;
}
.underworld-shell .uw-rarity-page .compare-tray button:focus-visible {
  outline: 2px solid #c3ff5c;
  outline-offset: 3px;
}

@media (max-width: 999px) {
  .underworld-shell .scw-wallet-select select,
  .underworld-shell .scw-recovery input,
  .underworld-shell .scw-studio .paint-color-filters input {
    font-size: 16px;
    min-height: 44px;
  }
  .underworld-shell .scw-wallet-select select {
    height: 48px;
  }

  /* At 1x, fit the whole square instead of cropping a wide canvas to a
     short viewport. The backing buffer and 2x/4x zoom wrapper stay intact. */
  .underworld-shell .scw-studio .paint-canvas-viewport {
    width: min(100%, calc(var(--uw-visible-height, 100dvh) * .65));
    height: auto;
    max-height: none;
    aspect-ratio: 1;
    margin-inline: auto;
  }

  .underworld-shell .scw-studio .paint-palette-expanded {
    max-height: clamp(100px, calc(var(--uw-visible-height, 100dvh) * .3), 260px);
    scroll-padding: 5px;
  }

  /* The display face is already heavy; synthetic bold and tight tracking
     close its counters at phone sizes. */
  .underworld-shell .portrait-lab.dark-room h2 {
    font-weight: 400;
    font-synthesis: none;
    letter-spacing: 0;
    line-height: 1.14;
    font-size: clamp(30px, 7vw, 42px);
  }

  .underworld-shell .uw-rarity-page .compare-tray {
    bottom: calc(var(--uw-fixed-dock-clearance, 72px) + 12px);
    z-index: 4;
    gap: 8px;
    padding: 8px;
    flex-wrap: wrap;
    justify-content: center;
    font-size: 12px;
    box-shadow: 0 8px 24px #0009;
    border-radius: 12px;
  }
}
@media (max-width: 499px) {
  .underworld-shell .uw-rarity-page .rarity-card h3 {
    font-size: clamp(18px, 5vw, 22px);
    line-height: 1.2;
    text-wrap: balance;
  }
}
