.pearl-contents {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 6px 4px 4px;
}

.pearl-headline {
  margin: 0 0 8px;
  color: var(--text);
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 1px 0 #000;
}

.pearl-feature {
  --p-light: var(--text);
  --p-glow: rgba(220, 230, 255, 0.5);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding: 8px 12px 8px 8px;
}

.pearl-feature-stage {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 108px;
  height: 100px;
}

.pearl-feature-stage::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 50%;
  background: url("../art/ui/planet-dais.webp") center / 100% 100% no-repeat;
  pointer-events: none;
}

.pearl-feature-stage::before {
  content: "";
  position: absolute;
  z-index: 1;
  left: 12%;
  right: 12%;
  bottom: 26%;
  height: 20%;
  background: radial-gradient(ellipse, var(--p-glow), transparent 70%);
  pointer-events: none;
}

.pearl-feature .pearl {
  position: relative;
  z-index: 2;
  width: 78px;
  height: 78px;
  margin-bottom: 22px;
  font-size: 78px;
  animation: pearl-bob 2.4s ease-in-out infinite;
}

.sheet:not(.open) .pearl-feature .pearl {
  animation: none;
}

.pearl-feature.empty .pearl {
  filter: grayscale(0.8) brightness(0.55);
  animation: none;
}

.pearl-feature-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.pearl-feature-rarity-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pearl-feature-rarity {
  color: var(--text);
  font-family: var(--display);
  font-size: 1.35rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 #000;
}

.pearl-feature-count,
.pearl-tile-count {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  background: var(--ruby);
  box-shadow: 0 0 0 1.5px var(--gold-deep), 0 2px 3px rgba(0, 0, 0, 0.5);
  color: var(--text);
  font-family: var(--display);
  font-size: 0.8rem;
  line-height: 22px;
  text-align: center;
  text-shadow: 0 1px 0 #000;
}

.pearl-feature-count[hidden],
.pearl-tile-count:empty {
  display: none;
}

.pearl-feature-name {
  color: var(--muted);
  font-family: var(--display);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 #000;
}

.pearl-go,
.pearl-open .pearl-collect.pearl-go,
.chart-reward .pearl-collect.pearl-go {
  border: 2px solid #b8ff8a;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.45), transparent 50%),
    linear-gradient(180deg, #8bf04e, #2fb52a 55%, #127a16);
  box-shadow: 0 0 0 1px #0b4a10, 0 3px 0 rgba(0, 0, 0, 0.55), 0 0 12px rgba(120, 255, 90, 0.35);
  color: #fff;
  font-family: var(--display);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(0, 60, 0, 0.7);
}

.pearl-go:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 0 0 1px #0b4a10, 0 1px 0 rgba(0, 0, 0, 0.55);
}

.pearl-go:disabled {
  opacity: 0.4;
  filter: grayscale(0.7);
}

.pearl-open-one {
  width: 100%;
  max-width: 180px;
  min-height: 56px;
  margin-top: 2px;
  font-size: 1.25rem;
}

.pearl-open-one,
.pearl-open-all {
  border: 3px solid var(--gold-light);
  border-radius: var(--radius);
  background: var(--gold-bevel);
  box-shadow: 0 0 0 1px var(--gold-deep), 0 4px 0 rgba(0, 0, 0, 0.55);
  color: var(--gold-deep);
  font-family: var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

.pearl-open-one:disabled,
.pearl-open-all:disabled {
  opacity: 0.65;
}

.pearl-open-one:active:not(:disabled),
.pearl-open-all:active:not(:disabled) {
  transform: translateY(2px);
}

.pearl-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(44px, 1fr)) minmax(44px, 1.2fr) minmax(44px, 1.4fr);
  gap: 4px;
  margin-bottom: 10px;
}

.pearl-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 72px;
  padding: 8px 2px 6px;
}

.pearl-tile.picked .pearl-tile-name {
  color: var(--gold-light);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.pearl-tile .pearl {
  width: 38px;
  height: 38px;
  font-size: 38px;
}

.pearl-tile:active:not(:disabled) {
  transform: scale(0.96);
}

.pearl-tile:disabled {
  opacity: 0.7;
}

.pearl-tile:disabled .pearl {
  filter: grayscale(1) brightness(0.35);
}

.pearl-tile-name {
  max-width: 100%;
  color: var(--text);
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.03em;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 0 #000;
}

.pearl-tile-count {
  position: absolute;
  top: -6px;
  right: -4px;
}

.pearl-open-all {
  display: block;
  width: 100%;
  max-width: 240px;
  min-height: 46px;
  margin: 0 auto 10px;
  background: linear-gradient(180deg, var(--violet), var(--navy));
  color: var(--text);
  text-shadow: 0 1px 0 #000;
  font-size: 1.1rem;
}

.pearl-odds-button {
  display: block;
  min-height: 44px;
  margin: -4px auto 0;
  padding: 0 12px;
  color: var(--muted);
  font-family: var(--display);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 0 #000;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pearl-odds[hidden] {
  display: none;
}

.pearl-boosts {
  margin-bottom: 10px;
  padding: 0 2px;
}

.pearl-boost-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
  color: var(--text);
  font-family: var(--display);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 0 #000;
}

.pearl-boost-row .pearl-boost-mark {
  width: 20px;
  height: 20px;
}

.pearl-boost-value {
  margin-left: auto;
  color: var(--gold-light);
  font-variant-numeric: tabular-nums;
}

.pearl-boost-timer {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pearl-boost-note {
  display: block;
  padding-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
  text-align: center;
}

#pearl-sheet .pearl-odds {
  color: var(--text);
  font-family: var(--body);
  font-size: 13px;
  line-height: 1.35;
  text-shadow: 0 1px 2px #000;
}

.pearl-odds dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
  margin: 0;
}

.pearl-odds dl > div {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  padding: 3px 0;
  border-bottom: 1px solid var(--hairline);
}

.pearl-odds dd {
  margin: 0;
  color: var(--gold-light);
  font-variant-numeric: tabular-nums;
}

.pearl-odds p {
  margin: 5px 0 0;
}

.pearl-open {
  --reward-space-top: #160b38;
  --reward-space-base: #08051e;
  --reward-mist-blue: rgba(64, 111, 225, 0.24);
  --reward-mist-pink: rgba(187, 53, 173, 0.2);
  --reward-ray: rgba(200, 220, 255, 0.7);
  --reward-ray-soft: rgba(150, 180, 255, 0.5);
  --reward-meteor: #c5ddff;
  position: fixed;
  inset: 0;
  z-index: 48;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: calc(var(--safe-top) + 12px) 20px calc(var(--safe-bottom) + 20px);
  background: radial-gradient(ellipse at 50% 42%, #5b1fa6 0, #2a0d6b 32%, #0c0833 66%, #04021a);
  overflow: hidden;
}

.pearl-open.show {
  display: flex;
}

body:has(> #pearl-open.show:not(.leaving)) > :is(#lobby, #app),
body:has(> #card-show.show) > :is(#lobby, #app) {
  content-visibility: hidden;
}

.pearl-open > * {
  position: relative;
  z-index: 2;
}

.pearl-open > .pearl-open-chamber,
.pearl-open > .pearl-open-space {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}

.pearl-open > .pearl-open-chamber {
  background: #0c0833 url("../art/planets/chamber.webp") 50% 50% / cover no-repeat;
}

.pearl-open-chamber > span {
  position: absolute;
}

.chamber-beam {
  top: -3%;
  width: 36%;
  height: 78%;
  background: linear-gradient(180deg, rgba(225, 240, 255, 0.85), rgba(110, 160, 255, 0.35) 45%, transparent 92%);
  clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%);
  transform-origin: 50% 0;
  mix-blend-mode: screen;
  opacity: 0.6;
}

.chamber-beam.left {
  left: 4%;
  transform: rotate(-34deg);
  animation: beam-sweep-left 3.2s ease-in-out infinite alternate;
}

.chamber-beam.right {
  right: 4%;
  transform: rotate(34deg);
  animation: beam-sweep-right 3.2s ease-in-out infinite alternate;
}

