/* External same-origin stylesheet to satisfy strict CSP. Desktop PWA only. */
#cc-gitcorn-pwa-refresh {
  position: fixed;
  z-index: 1100;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
  border-radius: 8px;
  background: var(--gl-background-color-default, #1b1e22);
  color: var(--gl-text-color-default, #f5f5f5);
  cursor: pointer;
  -webkit-app-region: no-drag;
  app-region: no-drag;
}
#cc-gitcorn-pwa-refresh svg { width: 17px; height: 17px; }
#cc-gitcorn-pwa-refresh:hover { background: var(--gl-background-color-subtle, #2b3037); }
#cc-gitcorn-pwa-refresh:focus-visible {
  outline: 2px solid var(--gl-focus-ring-color, #4990ef);
  outline-offset: 2px;
}
/* Native PWA titlebar placement only with supported Window Controls Overlay. */
#cc-gitcorn-pwa-refresh[data-placement="titlebar"] {
  left: calc(env(titlebar-area-x, 0px) + env(titlebar-area-width, 100vw) - 38px);
  top: calc(env(titlebar-area-y, 0px) + (env(titlebar-area-height, 38px) - 30px) / 2);
}
/* Fallback: the browser cannot be made to expose an editable native titlebar. */
#cc-gitcorn-pwa-refresh[data-placement="navigation"] { top: 8px; right: 66px; }

/* CC-GITCORN-INSTALL-SNACKBAR-V1-BEGIN */
/* GitCorn PWA install prompt: safe-area aware, opt-in, does not cover login.
   Original v5 refresh control remains completely untouched. */
#cc-gitcorn-install-snackbar {
  position: fixed;
  z-index: 1105;
  bottom: max(18px, env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  box-sizing: border-box;
  width: min(540px, calc(100vw - 24px));
  padding: 15px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid rgba(93, 193, 151, .26);
  border-radius: 16px;
  box-shadow: 0 14px 45px rgba(0, 0, 0, .28);
  background: #15251f;
  color: #eef7f2;
  font: 13px/1.45 system-ui, -apple-system, sans-serif;
  -webkit-app-region: no-drag;
  app-region: no-drag;
}
#cc-gitcorn-install-snackbar .cc-gitcorn-install-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}
#cc-gitcorn-install-snackbar .cc-gitcorn-install-copy strong {
  font-size: 14px;
  font-weight: 700;
}
#cc-gitcorn-install-snackbar .cc-gitcorn-install-copy span {
  color: #b8cfc5;
}
#cc-gitcorn-install-snackbar .cc-gitcorn-install-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 8px;
}
#cc-gitcorn-install-snackbar button {
  cursor: pointer;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 9px;
  font: inherit;
  font-weight: 650;
}
#cc-gitcorn-install-snackbar .cc-gitcorn-install-primary {
  border: 1px solid #ddab62;
  background: #e9a348;
  color: #1c251f;
}
#cc-gitcorn-install-snackbar .cc-gitcorn-install-later {
  border: 1px solid rgba(182, 218, 197, .22);
  background: transparent;
  color: #dbece2;
}
#cc-gitcorn-install-snackbar button:focus-visible {
  outline: 2px solid #b1f5d1;
  outline-offset: 2px;
}
#cc-gitcorn-install-snackbar button:disabled { opacity: .65; cursor: wait; }
@media (max-width: 460px) {
  #cc-gitcorn-install-snackbar { align-items: stretch; flex-direction: column; gap: 12px; }
  #cc-gitcorn-install-snackbar .cc-gitcorn-install-actions { justify-content: flex-end; }
}
@media (prefers-color-scheme: light) {
  #cc-gitcorn-install-snackbar { background: #f6faf7; color: #173f31; border-color: #bad9c8; }
  #cc-gitcorn-install-snackbar .cc-gitcorn-install-copy span { color: #416754; }
  #cc-gitcorn-install-snackbar .cc-gitcorn-install-later { color: #1d5138; border-color: #bdd8c8; }
}
@media (prefers-reduced-motion: reduce) {
  #cc-gitcorn-install-snackbar { scroll-behavior: auto; }
}
/* CC-GITCORN-INSTALL-SNACKBAR-V1-END */

/* CC-GITCORN-PWA-MOBILE-REFRESH-BEGIN */
/* GitCorn PWA: mobile-only refresh placement.
 * Appends to the installed v5 stylesheet; avoids rewriting the existing
 * titlebar/navigation placements used on desktop. No new DOM or JS.
 */
@media (max-width: 767px), (max-width: 1024px) and (hover: none) and (pointer: coarse) {
  #cc-gitcorn-pwa-refresh[data-placement] {
    top: auto !important;
    left: auto !important;
    right: calc(env(safe-area-inset-right, 0px) + 16px) !important;
    bottom: calc(env(safe-area-inset-bottom, 0px) + var(--cc-gitcorn-mobile-refresh-offset, 20px)) !important;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    border-color: rgba(199, 138, 54, .45);
    background: #101916;
    color: #C78A36;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  #cc-gitcorn-pwa-refresh[data-placement] svg {
    width: 20px;
    height: 20px;
  }
  #cc-gitcorn-pwa-refresh[data-placement]:focus-visible {
    outline: 2px solid #C78A36;
    outline-offset: 3px;
  }
}
/* CC-GITCORN-PWA-MOBILE-REFRESH-END */

/* CC-GITCORN-PWA-REFRESH-ICON-V1-BEGIN */
/* GitCorn mobile PWA refresh: reliable, two-tone-free circular arrow.
 * The legacy SVG may inherit GitLab icon fill rules and render as a dark dot.
 * Draw a pure CSS icon on mobile ONLY. Desktop SVG remains unchanged.
 * Accessible name/click behavior come from existing button aria-label and JS.
 */
@media (max-width: 767px), (max-width: 1024px) and (hover: none) and (pointer: coarse) {
  #cc-gitcorn-pwa-refresh[data-placement] {
    color: #C78A36 !important;
    background-color: #101916 !important;
    position: fixed;
    isolation: isolate;
  }
  #cc-gitcorn-pwa-refresh[data-placement] > svg {
    display: none !important;
  }
  #cc-gitcorn-pwa-refresh[data-placement]::before {
    content: "";
    display: block;
    position: absolute;
    width: 19px;
    height: 19px;
    box-sizing: border-box;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    transform: rotate(-28deg);
    pointer-events: none;
  }
  #cc-gitcorn-pwa-refresh[data-placement]::after {
    content: "";
    display: block;
    position: absolute;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 7px solid currentColor;
    transform: translate(8px, -8px) rotate(45deg);
    pointer-events: none;
  }
}
/* CC-GITCORN-PWA-REFRESH-ICON-V1-END */
