.offline-cache {
  position: fixed;
  top: max(0px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 140;
  display: grid;
  width: min(316px, calc(100vw - 28px));
  justify-items: end;
  color: #171513;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  pointer-events: none;
}

.offline-cache__toggle,
.offline-cache__button {
  position: relative;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
  outline: none;
  pointer-events: auto;
}

.offline-cache__toggle {
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 55px;
  padding-top: 8px;
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, .10));
  transition: transform .2s ease;
}

.offline-cache__toggle::before,
.offline-cache__button::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background:
    linear-gradient(rgba(255, 255, 255, .72), rgba(255, 255, 255, .72)),
    repeating-linear-gradient(102deg, transparent 0 11px, rgba(26, 26, 26, .06) 12px, transparent 13px),
    #fff;
  clip-path: polygon(0% 0%, 100% 0%, 100% 0%, 98% 10%, 100% 20%, 97% 35%, 100% 50%, 98% 65%, 100% 80%, 97% 90%, 100% 100%, 90% 97%, 80% 100%, 70% 96%, 60% 100%, 50% 97%, 40% 100%, 30% 96%, 20% 100%, 10% 97%, 0% 100%, 0% 100%, 2% 90%, 0% 80%, 3% 65%, 0% 50%, 2% 35%, 0% 20%, 3% 10%, 0% 0%);
}

.offline-cache__toggle::after,
.offline-cache__button::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  content: "";
  border: 1.5px solid rgba(26, 26, 26, .84);
  clip-path: polygon(0% 0%, 100% 0%, 100% 0%, 98% 10%, 100% 20%, 97% 35%, 100% 50%, 98% 65%, 100% 80%, 97% 90%, 100% 100%, 90% 97%, 80% 100%, 70% 96%, 60% 100%, 50% 97%, 40% 100%, 30% 96%, 20% 100%, 10% 97%, 0% 100%, 0% 100%, 2% 90%, 0% 80%, 3% 65%, 0% 50%, 2% 35%, 0% 20%, 3% 10%, 0% 0%);
  pointer-events: none;
}

.offline-cache__toggle:hover,
.offline-cache__button:hover {
  transform: translateY(-2px);
}

.offline-cache__toggle:active,
.offline-cache__button:active {
  transform: translateY(1px);
}

.offline-cache__toggle:focus-visible::after,
.offline-cache__button:focus-visible::after {
  border-color: #2f7f7a;
  box-shadow: 0 0 0 3px rgba(47, 127, 122, .18);
}

.offline-cache__toggle svg {
  position: relative;
  z-index: 1;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
  transition: transform .22s ease;
}

.offline-cache:not(.is-collapsed) .offline-cache__toggle svg {
  transform: rotate(180deg);
}

.offline-cache__panel {
  position: relative;
  z-index: 1;
  display: grid;
  width: 100%;
  gap: 10px;
  padding: 12px;
  margin-top: 8px;
  background:
    radial-gradient(circle at 24% 12%, rgba(255, 255, 255, .9), transparent 30%),
    repeating-linear-gradient(98deg, rgba(26, 26, 26, .035) 0 1px, transparent 1px 13px),
    rgba(255, 255, 255, .9);
  border: 1px solid rgba(24, 24, 24, .22);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .14), inset 0 0 0 1px rgba(255, 255, 255, .72);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  clip-path: polygon(0% 0%, 100% 0%, 100% 0%, 99% 8%, 100% 16%, 98% 28%, 100% 41%, 99% 54%, 100% 67%, 98% 80%, 100% 92%, 100% 100%, 91% 98%, 82% 100%, 73% 97%, 64% 100%, 55% 98%, 46% 100%, 37% 97%, 28% 100%, 19% 98%, 10% 100%, 0% 99%, 1% 90%, 0% 80%, 2% 68%, 0% 55%, 1% 42%, 0% 29%, 2% 17%, 0% 8%, 0% 0%);
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  transform-origin: top right;
  transition: opacity .22s ease, transform .24s cubic-bezier(.16, 1, .3, 1), visibility .22s ease;
  visibility: visible;
}

.offline-cache.is-collapsed .offline-cache__panel {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-14px) scale(.97);
  visibility: hidden;
}

.offline-cache__top {
  display: flex;
  align-items: center;
  gap: 9px;
}

.offline-cache__button {
  display: grid;
  width: 100%;
  min-height: 48px;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  font: 900 13px/1.1 inherit;
  letter-spacing: 0;
  text-align: left;
}

.offline-cache__button svg,
.offline-cache__button span {
  position: relative;
  z-index: 1;
}

.offline-cache__button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.offline-cache__button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.offline-cache__button:disabled {
  cursor: default;
  opacity: .72;
}

.offline-cache__meter {
  position: relative;
  height: 7px;
  overflow: hidden;
  background: rgba(23, 21, 19, .1);
  border: 1px solid rgba(23, 21, 19, .08);
}

.offline-cache__fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #2f7f7a, #d1a13c);
  transition: width .18s ease;
}

.offline-cache.is-working .offline-cache__fill {
  background: linear-gradient(90deg, #3d6d95, #d1a13c);
}

.offline-cache__meta {
  min-height: 15px;
  color: rgba(23, 21, 19, .68);
  font-size: 11px;
  line-height: 1.35;
}

.offline-cache__meta strong {
  color: #171513;
}

.offline-cache.is-ready .offline-cache__button::before {
  background:
    linear-gradient(rgba(235, 249, 244, .84), rgba(235, 249, 244, .84)),
    repeating-linear-gradient(102deg, transparent 0 11px, rgba(47, 127, 122, .08) 12px, transparent 13px),
    #fff;
}

.offline-cache.is-ready .offline-cache__fill {
  background: #2f7f7a;
}

.offline-cache.is-error .offline-cache__button::before {
  background:
    linear-gradient(rgba(255, 237, 233, .86), rgba(255, 237, 233, .86)),
    repeating-linear-gradient(102deg, transparent 0 11px, rgba(163, 59, 47, .08) 12px, transparent 13px),
    #fff;
}

.offline-cache.is-error .offline-cache__fill {
  background: #a33b2f;
}

@media (min-width: 769px) {
  .navigation-ui .nav-controls {
    right: calc(max(16px, env(safe-area-inset-right)) + 62px);
  }
}

@media (max-width: 720px) {
  .offline-cache {
    right: 10px;
    width: min(286px, calc(100vw - 20px));
  }

  .offline-cache__toggle {
    width: 44px;
    height: 50px;
  }

  .offline-cache__panel {
    padding: 10px;
    margin-top: 12px;
  }

  .offline-cache__button {
    min-height: 44px;
    font-size: 12px;
  }
}
