:root {
  --wg-share-bg: rgba(255,255,255,.88);
  --wg-share-line: rgba(148,163,184,.28);
  --wg-share-text: #111827;
  --wg-share-shadow: 0 18px 50px rgba(15,23,42,.14);
  --wg-share-accent: #a855f7;
}

[data-theme="dark"], .theme-dark, .dark {
  --wg-share-bg: rgba(17,24,39,.84);
  --wg-share-line: rgba(255,255,255,.16);
  --wg-share-text: #f9fafb;
  --wg-share-shadow: 0 20px 60px rgba(0,0,0,.28);
}

.wg-share {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  top: max(18px, env(safe-area-inset-top));
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.wg-share__main,
.wg-share__item {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--wg-share-line);
  border-radius: 999px;
  background: var(--wg-share-bg);
  color: var(--wg-share-text);
  box-shadow: var(--wg-share-shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  cursor: pointer;
  pointer-events: auto;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, opacity .18s ease;
  text-decoration: none;
}

.wg-share__main:hover,
.wg-share__item:hover,
.wg-share__main:focus-visible,
.wg-share__item:focus-visible {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--wg-share-accent), transparent 42%);
  outline: none;
}

.wg-share svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.wg-share__main {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, #a855f7, #38bdf8);
  color: #fff;
}

.wg-share__menu {
  display: flex;
  align-items: center;
  gap: 7px;
  opacity: 0;
  transform: translateX(10px) scale(.98);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.wg-share:hover .wg-share__menu,
.wg-share.is-open .wg-share__menu,
.wg-share:focus-within .wg-share__menu {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
}

.wg-share.is-copied .wg-share__main::after {
  content: "Kopioitu";
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(17,24,39,.92);
  color: #fff;
  font-size: 12px;
  font-weight: 560;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .wg-share {
    right: max(12px, env(safe-area-inset-right));
    top: max(12px, env(safe-area-inset-top));
  }

  .wg-share__main {
    width: 44px;
    height: 44px;
  }

  .wg-share__menu {
    position: absolute;
    right: 0;
    top: 54px;
    flex-direction: column;
    padding: 7px;
    border-radius: 999px;
    background: rgba(255,255,255,.62);
    border: 1px solid var(--wg-share-line);
    box-shadow: var(--wg-share-shadow);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .wg-share__item {
    width: 40px;
    height: 40px;
  }
}
