:root {
  --bc-goal-gold: #f5b942;
  --bc-goal-gold-bright: #ffe89a;
  --bc-goal-gold-deep: #9c6500;
  --bc-goal-track: #090805;
}

.bc-patch-goal {
  width: clamp(180px, 18vw, 270px);
  min-width: 180px;
  flex: 0 1 270px;
  align-self: center;
  display: grid;
  gap: 3px;
  margin: 0 12px 0 4px;
  color: #fff7d6;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.bc-patch-goal-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px;
  color: #d9c17a;
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.bc-patch-goal-label strong {
  color: var(--bc-goal-gold-bright);
  font-size: 8px;
}

.bc-patch-goal-tube {
  position: relative;
  height: 22px;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(255, 218, 112, .72);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .08), transparent 42%),
    var(--bc-goal-track);
  box-shadow:
    inset 0 0 0 2px rgba(91, 55, 0, .58),
    inset 0 4px 8px rgba(0, 0, 0, .82),
    0 0 7px rgba(245, 185, 66, .38),
    0 0 18px rgba(245, 185, 66, .12);
}

.bc-patch-goal-tube::before,
.bc-patch-goal-tube::after {
  content: "";
  position: absolute;
  z-index: 4;
  top: 3px;
  bottom: 3px;
  width: 4px;
  border-radius: 999px;
  background: rgba(255, 239, 184, .72);
  box-shadow: 0 0 7px rgba(255, 215, 94, .7);
  pointer-events: none;
}

.bc-patch-goal-tube::before { left: 4px; }
.bc-patch-goal-tube::after { right: 4px; }

.bc-patch-goal-liquid {
  position: absolute;
  z-index: 1;
  inset: 2px auto 2px 2px;
  width: var(--bc-goal-progress, 0%);
  min-width: 0;
  overflow: hidden;
  border-radius: 999px;
  background:
    radial-gradient(circle at 18% 34%, rgba(255, 255, 255, .88) 0 1px, transparent 2px),
    radial-gradient(circle at 46% 72%, rgba(255, 248, 193, .74) 0 1px, transparent 2px),
    radial-gradient(circle at 78% 30%, rgba(255, 255, 255, .65) 0 1px, transparent 2px),
    linear-gradient(180deg, #fff1a7 0%, #ffc947 33%, #e99a00 72%, #9b5a00 100%);
  background-size: 62px 18px, 84px 18px, 96px 18px, auto;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .85),
    inset 0 -2px 4px rgba(111, 57, 0, .58),
    0 0 9px rgba(255, 191, 50, .94),
    0 0 20px rgba(255, 177, 0, .58);
  transition: width 1.8s cubic-bezier(.2, .8, .2, 1);
  animation: bc-goal-liquid-flow 3.6s linear infinite;
}

.bc-patch-goal-liquid::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    110deg,
    transparent 0 28%,
    rgba(255, 255, 255, .46) 42%,
    transparent 57% 100%
  );
  transform: translateX(-130%);
  animation: bc-goal-shimmer 2.8s ease-in-out infinite;
}

.bc-patch-goal-text {
  position: absolute;
  z-index: 5;
  inset: 0 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff9e7;
  font-size: 9px;
  font-weight: 950;
  letter-spacing: .02em;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  text-shadow:
    0 1px 2px #000,
    0 0 4px #000,
    0 0 8px rgba(0, 0, 0, .82);
  white-space: nowrap;
  pointer-events: none;
}

.bc-patch-goal[data-reached="true"] .bc-patch-goal-tube {
  border-color: #fff0a4;
  box-shadow:
    inset 0 0 0 2px rgba(119, 73, 0, .6),
    inset 0 4px 8px rgba(0, 0, 0, .65),
    0 0 11px rgba(255, 217, 92, .95),
    0 0 28px rgba(255, 185, 0, .64);
}

.bc-patch-goal[data-reached="true"] .bc-patch-goal-text {
  color: #fff;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.bc-patch-goal[data-loading="true"] .bc-patch-goal-liquid {
  width: 18%;
  opacity: .65;
  animation:
    bc-goal-loading 1.45s ease-in-out infinite alternate,
    bc-goal-liquid-flow 3.6s linear infinite;
}

@keyframes bc-goal-liquid-flow {
  from { background-position: 0 0, 0 0, 0 0, 0 0; }
  to { background-position: 62px 0, -84px 0, 96px 0, 0 0; }
}

@keyframes bc-goal-shimmer {
  0%, 20% { transform: translateX(-130%); }
  72%, 100% { transform: translateX(150%); }
}

@keyframes bc-goal-loading {
  from { transform: translateX(-15%); }
  to { transform: translateX(450%); }
}

@media (max-width: 950px) {
  .bc-patch-goal {
    width: clamp(150px, 20vw, 210px);
    min-width: 150px;
    flex-basis: 210px;
    margin-right: 8px;
  }

  .bc-patch-goal-label span {
    display: none;
  }
}

@media (max-width: 680px) {
  .bc-patch-goal {
    width: min(44vw, 184px);
    min-width: 132px;
    flex-basis: 184px;
    gap: 2px;
    margin-left: 2px;
    margin-right: 6px;
  }

  .bc-patch-goal-label {
    display: none;
  }

  .bc-patch-goal-tube {
    height: 20px;
  }

  .bc-patch-goal-text {
    font-size: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bc-patch-goal-liquid,
  .bc-patch-goal-liquid::after {
    animation: none !important;
  }
}

@media (max-width: 520px) {
  header.topbar,
  header.site-header,
  body > header {
    height: auto !important;
    min-height: 58px;
  }

  header.topbar > .nav,
  header.site-header > .header-inner,
  body > header > .nav,
  header.topbar:not(:has(> .nav)) {
    height: auto !important;
    min-height: 58px;
    flex-wrap: wrap;
    row-gap: 4px;
    padding-top: 5px;
    padding-bottom: 5px;
  }

  .bc-patch-goal {
    order: 99;
    width: 100%;
    min-width: 100%;
    flex: 1 0 100%;
  }

  .bc-patch-goal-tube {
    height: 18px;
  }

  .shell:has(> .topbar .bc-patch-goal) {
    grid-template-rows: 92px minmax(0, 1fr) 82px;
  }
}
