.trophy-case {
  font-family: var(--case-font-family);
  overflow: hidden;
  padding-bottom: calc(var(--shelf-height) * 0.55);
  border-top: var(--case-frame-border-top);
  border-right: var(--case-frame-border-right);
  border-bottom: var(--case-frame-border-bottom);
  border-left: var(--case-frame-border-left);
  border-radius: var(--case-frame-border-radius);
  background: var(--case-frame-background);
  box-shadow: var(--case-frame-box-shadow);
  color: var(--case-frame-color);
  text-shadow: var(--case-frame-text-shadow);
  filter: var(--case-frame-filter);
  image-rendering: var(--case-frame-image-rendering);
}

.trophy-shelf {
  position: relative;
  display: block;
  border-top: var(--shelf-border-top);
  border-right: var(--shelf-border-right);
  border-bottom: var(--shelf-border-bottom);
  border-left: var(--shelf-border-left);
  border-radius: var(--shelf-border-radius);
  background: var(--shelf-background);
  box-shadow: var(--shelf-box-shadow);
  color: var(--shelf-color);
  text-shadow: var(--shelf-text-shadow);
  filter: var(--shelf-filter);
  image-rendering: var(--shelf-image-rendering);
  margin-top: var(--shelf-margin-top);
  margin-right: var(--shelf-margin-right);
  margin-bottom: var(--shelf-margin-bottom);
  margin-left: var(--shelf-margin-left);
  min-height: var(--shelf-min-height);
  padding-bottom: var(--shelf-padding-bottom);
}

.trophy-shelf::before,
.trophy-shelf::after {
  position: absolute;
  z-index: 5;
  top: 0;
  bottom: var(--shelf-height);
  content: "";
  pointer-events: none;
}

.trophy-shelf::before {
  left: 0;
  width: var(--shelf-frame-left-width);
  background: var(--shelf-frame-left-surface);
  box-shadow: var(--shelf-frame-left-shadow);
}

.trophy-shelf::after {
  right: 0;
  width: var(--shelf-frame-right-width);
  background: var(--shelf-frame-right-surface);
  box-shadow: var(--shelf-frame-right-shadow);
}

.shelf-bar {
  position: absolute;
  z-index: 2;
  border-top: var(--shelf-bar-border-top);
  border-right: var(--shelf-bar-border-right);
  border-bottom: var(--shelf-bar-border-bottom);
  border-left: var(--shelf-bar-border-left);
  border-radius: var(--shelf-bar-border-radius);
  background: var(--shelf-bar-background);
  box-shadow: var(--shelf-bar-box-shadow);
  color: var(--shelf-bar-color);
  text-shadow: var(--shelf-bar-text-shadow);
  filter: var(--shelf-bar-filter);
  image-rendering: var(--shelf-bar-image-rendering);
  left: var(--shelf-bar-left);
  right: var(--shelf-bar-right);
  bottom: var(--shelf-bar-bottom);
  height: var(--shelf-height);
}

.shelf-bar::after {
  position: absolute;
  z-index: 3;
  content: "";
  border-top: var(--shelf-decoration-border-top);
  border-right: var(--shelf-decoration-border-right);
  border-bottom: var(--shelf-decoration-border-bottom);
  border-left: var(--shelf-decoration-border-left);
  border-radius: var(--shelf-decoration-border-radius);
  background: var(--shelf-decoration-background);
  box-shadow: var(--shelf-decoration-box-shadow);
  color: var(--shelf-decoration-color);
  text-shadow: var(--shelf-decoration-text-shadow);
  filter: var(--shelf-decoration-filter);
  image-rendering: var(--shelf-decoration-image-rendering);
  left: var(--shelf-decoration-left);
  right: var(--shelf-decoration-right);
  bottom: var(--shelf-decoration-bottom);
  top: var(--shelf-decoration-top);
  width: var(--shelf-decoration-width);
  height: var(--shelf-decoration-height);
  display: var(--shelf-decoration-display);
  opacity: var(--shelf-decoration-opacity);
  transform: var(--shelf-decoration-transform);
}

.trophy-case .trophy-shelf>.streamer-sign {
  top: var(--nameplate-top);
}

/* Match the first plaque's attachment to the header bar. Subsequent bars
   belong to shelves, whose bottom border and margin can differ from the header. */
.trophy-case>.trophy-shelf~.trophy-shelf>.streamer-sign,
.trophy-case>.case-shelf-unit~.case-shelf-unit>.trophy-shelf>.streamer-sign {
  top: calc(var(--nameplate-top) + var(--case-header-border-bottom-width) - var(--shelf-border-bottom-width) - max(0px, var(--shelf-margin-bottom) - var(--shelf-margin-top)));
}

.streamer-sign {
  position: absolute;
  z-index: 6;
  top: 4px;
  display: flex;
  align-items: center;
  text-decoration: none;
  border-top: var(--nameplate-border-top);
  border-right: var(--nameplate-border-right);
  border-bottom: var(--nameplate-border-bottom);
  border-left: var(--nameplate-border-left);
  border-radius: var(--nameplate-border-radius);
  background: var(--nameplate-background);
  box-shadow: var(--nameplate-box-shadow);
  color: var(--nameplate-color);
  text-shadow: var(--nameplate-text-shadow);
  filter: var(--nameplate-filter);
  image-rendering: var(--nameplate-image-rendering);
  left: var(--nameplate-left);
  max-width: var(--nameplate-max-width);
  min-height: var(--nameplate-min-height);
  gap: var(--nameplate-gap);
  padding: var(--nameplate-padding);
  transform: var(--nameplate-transform);
}

.streamer-sign-logo {
  display: grid;
  flex: 0 0 var(--nameplate-logo-size);
  width: var(--nameplate-logo-size);
  height: var(--nameplate-logo-size);
  place-items: center;
  font-size: var(--nameplate-logo-font-size);
  font-weight: 900;
  object-fit: cover;
  border-top: var(--nameplate-logo-border-top);
  border-right: var(--nameplate-logo-border-right);
  border-bottom: var(--nameplate-logo-border-bottom);
  border-left: var(--nameplate-logo-border-left);
  border-radius: var(--nameplate-logo-border-radius);
  background: var(--nameplate-logo-background);
  box-shadow: var(--nameplate-logo-box-shadow);
  color: var(--nameplate-logo-color);
  text-shadow: var(--nameplate-logo-text-shadow);
  filter: var(--nameplate-logo-filter);
  image-rendering: var(--nameplate-logo-image-rendering);
}

.streamer-sign-name {
  overflow: hidden;
  font-size: var(--nameplate-font-size);
  font-weight: var(--nameplate-font-weight);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trophy-rail {
  position: absolute;
  right: 0;
  bottom: var(--shelf-height);
  left: 0;
  display: flex;
  justify-content: safe center;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
  height: 162px;
  padding: 16px 16px 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  scrollbar-color: var(--trophy-rail-scrollbar-color);
}

.trophy-rail::-webkit-scrollbar {
  display: none;
}

.trophy-rail:focus-visible {
  outline: 2px solid var(--streamer-accent);
  outline-offset: -3px;
}

.trophy {
  position: relative;
  z-index: 4;
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  justify-content: center;
  width: calc(var(--trophy-width, 102px) + 14px);
  height: 142px;
  padding: 8px 7px 0;
  outline: none;
}

.trophy:focus-visible .trophy-mystery,
.trophy:focus-visible .trophy-image {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.trophy-detail-link {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  color: inherit;
  text-decoration: none;
}

.trophy-detail-link:focus-visible {
  border-radius: 3px;
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.trophy-mystery {
  position: relative;
  overflow: hidden;
  align-self: end;
  width: var(--trophy-width, 102px);
  height: var(--trophy-height, 102px);
  border: 1px solid #393939;
  background: #181719;
  image-rendering: pixelated;
}

.trophy-image {
  display: block;
  align-self: flex-end;
  width: var(--trophy-width, 102px);
  height: var(--trophy-height, 102px);
  object-fit: contain;
  image-rendering: auto;
}

.trophy-mystery::before,
.trophy-mystery::after {
  position: absolute;
  top: 50%;
  left: 50%;
  content: "";
  transform: translate(-50%, -50%);
}

.trophy-mystery::before {
  width: 8px;
  height: 8px;
  background: #302d33;
  box-shadow:
    -34px -32px #252328,
    -28px 9px #3b3740,
    -13px -16px #29262c,
    -7px 31px #343039,
    16px -34px #3e3943,
    25px 4px #28252b,
    35px 30px #39353d,
    4px 17px #252328,
    33px -14px #343039;
}

.trophy-mystery::after {
  width: 5px;
  height: 5px;
  background: #45404a;
  box-shadow:
    -36px 29px #45404a,
    -25px -8px #312e35,
    -9px -35px #49434e,
    8px 15px #403b45,
    23px -20px #2e2b31,
    35px 5px #46414b,
    -31px -27px #3c3841,
    30px 34px #49434e;
}

@media (max-width: 480px) {
  .trophy-shelf {
    min-height: var(--shelf-min-height-mobile);
  }

  .trophy-rail {
    padding-inline: 8px;
  }
}

.trophy-shelf.is-alternate {
  background: var(--shelf-alternate-background);
  box-shadow: var(--shelf-alternate-box-shadow);
  --shelf-frame-right-surface: var(--shelf-alternate-frame-right-surface);
  --shelf-frame-left-surface: var(--shelf-alternate-frame-left-surface);
}
